csonpath 0.13.0__tar.gz → 0.13.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {csonpath-0.13.0 → csonpath-0.13.1}/Makefile +11 -3
  2. {csonpath-0.13.0/csonpath.egg-info → csonpath-0.13.1}/PKG-INFO +1 -1
  3. {csonpath-0.13.0 → csonpath-0.13.1/csonpath.egg-info}/PKG-INFO +1 -1
  4. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath_do.h +9 -6
  5. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath_python.c +13 -2
  6. {csonpath-0.13.0 → csonpath-0.13.1}/pyproject.toml +2 -2
  7. {csonpath-0.13.0 → csonpath-0.13.1}/LICENSE +0 -0
  8. {csonpath-0.13.0 → csonpath-0.13.1}/MANIFEST.in +0 -0
  9. {csonpath-0.13.0 → csonpath-0.13.1}/README.md +0 -0
  10. {csonpath-0.13.0 → csonpath-0.13.1}/configure +0 -0
  11. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath.egg-info/SOURCES.txt +0 -0
  12. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath.egg-info/dependency_links.txt +0 -0
  13. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath.egg-info/requires.txt +0 -0
  14. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath.egg-info/top_level.txt +0 -0
  15. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath.h +0 -0
  16. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath_json-c.h +0 -0
  17. {csonpath-0.13.0 → csonpath-0.13.1}/csonpath_yyjson.h +0 -0
  18. {csonpath-0.13.0 → csonpath-0.13.1}/setup.cfg +0 -0
  19. {csonpath-0.13.0 → csonpath-0.13.1}/setup.py +0 -0
  20. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/.git +0 -0
  21. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/.github/workflows/c-cpp.yml +0 -0
  22. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/.gitignore +0 -0
  23. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/LICENSE +0 -0
  24. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/Makefile +0 -0
  25. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/README.md +0 -0
  26. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/clib.json +0 -0
  27. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/formal_verification.md +0 -0
  28. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/re.c +0 -0
  29. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/re.h +0 -0
  30. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/scripts/exrex.py +0 -0
  31. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/scripts/regex_test.py +0 -0
  32. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/scripts/regex_test_neg.py +0 -0
  33. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/tests/test1.c +0 -0
  34. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/tests/test2.c +0 -0
  35. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/tests/test3.c +0 -0
  36. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/tests/test_compile.c +0 -0
  37. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/tests/test_print.c +0 -0
  38. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/tests/test_rand.c +0 -0
  39. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/tests/test_rand_neg.c +0 -0
  40. {csonpath-0.13.0 → csonpath-0.13.1}/tiny-regex-c/tests/test_thread.c +0 -0
@@ -3,7 +3,7 @@ JSON_C_LDFLAGS=$(shell pkg-config --libs json-c)
3
3
 
4
4
  include config.mk
5
5
 
6
- all: test-json-c-get-a test-json-update test-json-filter test-json-subpath test-json-c-array-root
6
+ all: test-json-c-get-a test-json-update test-json-filter test-json-subpath test-json-c-array-root test-json-filter-and-missing-key test-json-get-array-big-index
7
7
 
8
8
  bench:
9
9
  make -C bench
@@ -30,12 +30,20 @@ test-json-filter: tests/json-c/filter.c csonpath_json-c.h csonpath.h csonpath_do
30
30
  test-json-subpath: tests/json-c/subpath.c csonpath_json-c.h csonpath.h csonpath_do.h
31
31
  $(CC) tests/json-c/subpath.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-subpath $(JSON_C_LDFLAGS) $(LDFLAGS)
32
32
 
33
- tests-c: test-json-c-get-a test-json-update test-json-filter test-json-subpath test-json-c-array-root
33
+ test-json-filter-and-missing-key: tests/json-c/filter-and-missing-key.c csonpath_json-c.h csonpath.h csonpath_do.h
34
+ $(CC) tests/json-c/filter-and-missing-key.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-filter-and-missing-key $(JSON_C_LDFLAGS) $(LDFLAGS)
35
+
36
+ test-json-get-array-big-index: tests/json-c/get-array-big-index.c csonpath_json-c.h csonpath.h csonpath_do.h
37
+ $(CC) tests/json-c/get-array-big-index.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-get-array-big-index $(JSON_C_LDFLAGS) $(LDFLAGS)
38
+
39
+ tests-c: test-json-c-get-a test-json-update test-json-filter test-json-subpath test-json-c-array-root test-json-filter-and-missing-key test-json-get-array-big-index
34
40
  ./test-json-c-get-a
35
41
  ./test-json-update
36
42
  ./test-json-filter
37
43
  ./test-json-subpath
38
44
  ./test-json-c-array-root
45
+ ./test-json-filter-and-missing-key
46
+ ./test-json-get-array-big-index
39
47
 
40
48
  pip-dev:
41
49
  pip install -e .[dev] --force-reinstall
@@ -46,5 +54,5 @@ tests-py: pip-dev
46
54
  tests: tests-py tests-c
47
55
 
48
56
  clean:
49
- rm -rvf test-json-c-get-a test-json-update test-json-filter test-json-subpath
57
+ rm -rvf test-json-c-get-a test-json-update test-json-filter test-json-subpath test-json-c-array-root test-json-filter-and-missing-key test-json-get-array-big-index
50
58
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csonpath
3
- Version: 0.13.0
3
+ Version: 0.13.1
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Provides-Extra: dev
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csonpath
3
- Version: 0.13.0
3
+ Version: 0.13.1
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Provides-Extra: dev
@@ -161,7 +161,7 @@ static CSONPATH_DO_RET_TYPE csonpath_do_dotdot(const struct csonpath cjp[const s
161
161
  CSONPATH_DO_FIND_ALL;
162
162
  }
163
163
  }
164
- } else {
164
+ } else if (CSONPATH_IS_ARRAY(tmp)) {
165
165
  CSONPATH_FOREACH_ARRAY(tmp, el, key_idx) {
166
166
  CSONPATH_DO_FOREACH_PRE_SET;
167
167
  if (CSONPATH_IS_OBJ(el) || CSONPATH_IS_ARRAY(el)) {
@@ -212,9 +212,15 @@ static CSONPATH_DO_RET_TYPE csonpath_do_internal(const struct csonpath cjp[const
212
212
 
213
213
  (void) foreach_idx;
214
214
  CSONPATH_DO_FILTER_PRE_LOOP;
215
+ if (!CSONPATH_IS_ARRAY(tmp)) {
216
+ CSONPATH_DO_FILTER_OUT;
217
+ break;
218
+ }
215
219
  CSONPATH_FOREACH_ARRAY(tmp, el, foreach_idx)
216
220
  {
217
221
  intptr_t key_idx = foreach_idx;
222
+ filter_next = filter_next_in;
223
+ operation = operation_in;
218
224
  (void)key_idx;
219
225
  owalker = next;
220
226
  match_and_or_or:
@@ -226,7 +232,7 @@ static CSONPATH_DO_RET_TYPE csonpath_do_internal(const struct csonpath cjp[const
226
232
 
227
233
  if (csonpath_make_match(cjp, origin, el2, &owalker, operation)) {
228
234
  if (*owalker == CSONPATH_INST_FILTER_AND) {
229
- ++owalker; /* skip next */
235
+ ++owalker; /* skip and */
230
236
  operation = *owalker;
231
237
  ++owalker;
232
238
  filter_next = *owalker;
@@ -237,9 +243,6 @@ static CSONPATH_DO_RET_TYPE csonpath_do_internal(const struct csonpath cjp[const
237
243
  csonpath_do_internal(cjp, origin, el, tmp, owalker
238
244
  CSONPATH_DO_EXTRA_ARGS_NEESTED);
239
245
  CSONPATH_DO_FILTER_FIND;
240
- } else {
241
- operation = operation_in;
242
- filter_next = filter_next_in;
243
246
  }
244
247
  }
245
248
  }
@@ -385,7 +388,7 @@ static CSONPATH_DO_RET_TYPE csonpath_do_internal(const struct csonpath cjp[const
385
388
  this_idx = to_num.n;
386
389
  CSONPATH_PRE_GET(this_idx);
387
390
  tmp = CSONPATH_AT(tmp, to_num.n);
388
- walker += 5;
391
+ walker += 4;
389
392
  if (tmp == CSONPATH_NULL) {
390
393
  CSONPATH_DO_GET_NOTFOUND(this_idx);
391
394
  }
@@ -264,6 +264,8 @@ static PyObject *find_all(PyCsonPathObject *self, PyObject* args)
264
264
  BAD_ARG();
265
265
 
266
266
  PyObject *ret = csonpath_find_all(self->cp, json);
267
+ if (PyErr_Occurred())
268
+ return NULL;
267
269
 
268
270
  return ret;
269
271
  }
@@ -276,6 +278,8 @@ static PyObject *find_first(PyCsonPathObject *self, PyObject* args)
276
278
  BAD_ARG();
277
279
 
278
280
  PyObject *ret = csonpath_find_first(self->cp, json);
281
+ if (PyErr_Occurred())
282
+ return NULL;
279
283
 
280
284
  Py_INCREF(ret);
281
285
  return ret;
@@ -284,7 +288,7 @@ static PyObject *find_first(PyCsonPathObject *self, PyObject* args)
284
288
  static PyObject *print_instructions(PyCsonPathObject *self, PyObject *args, PyObject *kwds)
285
289
  {
286
290
  csonpath_print_instruction(self->cp);
287
- return Py_None;
291
+ Py_RETURN_NONE;
288
292
  }
289
293
 
290
294
  static PyObject *callback(PyCsonPathObject *self, PyObject* args)
@@ -294,6 +298,8 @@ static PyObject *callback(PyCsonPathObject *self, PyObject* args)
294
298
  if (!PyArg_ParseTuple(args, "OO|O", &json, &callback, &udata))
295
299
  BAD_ARG();
296
300
  int ret = csonpath_callback(self->cp, json, callback, udata);
301
+ if (PyErr_Occurred())
302
+ return NULL;
297
303
  return PyLong_FromLong(ret);
298
304
  }
299
305
 
@@ -304,6 +310,8 @@ static PyObject *do_remove(PyCsonPathObject *self, PyObject* args)
304
310
  if (!PyArg_ParseTuple(args, "O", &json))
305
311
  BAD_ARG();
306
312
  int ret = csonpath_remove(self->cp, json);
313
+ if (PyErr_Occurred())
314
+ return NULL;
307
315
  return PyLong_FromLong(ret);
308
316
  }
309
317
 
@@ -315,7 +323,7 @@ static PyObject *update_or_create(PyCsonPathObject *self, PyObject* args)
315
323
  if (!PyArg_ParseTuple(args, "OO", &json, &value))
316
324
  BAD_ARG();
317
325
  int ret = csonpath_update_or_create(self->cp, json, value);
318
- if (ret < 0) {
326
+ if (PyErr_Occurred() || ret < 0) {
319
327
  return NULL;
320
328
  }
321
329
  return PyLong_FromLong(ret);
@@ -328,6 +336,9 @@ static PyObject *update_or_create_callback(PyCsonPathObject *self, PyObject* arg
328
336
  if (!PyArg_ParseTuple(args, "OO|O", &json, &callback, &udata))
329
337
  BAD_ARG();
330
338
  int ret = csonpath_update_or_create_callback(self->cp, json, callback, udata);
339
+ if (PyErr_Occurred() || ret < 0) {
340
+ return NULL;
341
+ }
331
342
  return PyLong_FromLong(ret);
332
343
  }
333
344
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "csonpath"
7
- version = "0.13.0"
7
+ version = "0.13.1"
8
8
  readme = "README.md"
9
9
 
10
10
  [tool.setuptools]
@@ -27,7 +27,7 @@ test-command = "pytest {project}/tests/python"
27
27
  before-build = "choco install mingw -y"
28
28
 
29
29
  [tool.bumpversion]
30
- current_version = "0.13.0"
30
+ current_version = "0.13.1"
31
31
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
32
32
  serialize = ["{major}.{minor}.{patch}"]
33
33
  search = "{current_version}"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes