bitstruct 8.22.1__tar.gz → 8.23.0__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 (23) hide show
  1. {bitstruct-8.22.1/src/bitstruct.egg-info → bitstruct-8.23.0}/PKG-INFO +1 -1
  2. {bitstruct-8.22.1 → bitstruct-8.23.0}/src/bitstruct/__init__.py +1 -1
  3. {bitstruct-8.22.1 → bitstruct-8.23.0}/src/bitstruct/c.c +17 -0
  4. {bitstruct-8.22.1 → bitstruct-8.23.0/src/bitstruct.egg-info}/PKG-INFO +1 -1
  5. {bitstruct-8.22.1 → bitstruct-8.23.0}/tests/test_c.py +6 -0
  6. {bitstruct-8.22.1 → bitstruct-8.23.0}/LICENSE +0 -0
  7. {bitstruct-8.22.1 → bitstruct-8.23.0}/MANIFEST.in +0 -0
  8. {bitstruct-8.22.1 → bitstruct-8.23.0}/Makefile +0 -0
  9. {bitstruct-8.22.1 → bitstruct-8.23.0}/README.rst +0 -0
  10. {bitstruct-8.22.1 → bitstruct-8.23.0}/docs/Makefile +0 -0
  11. {bitstruct-8.22.1 → bitstruct-8.23.0}/docs/conf.py +0 -0
  12. {bitstruct-8.22.1 → bitstruct-8.23.0}/docs/index.rst +0 -0
  13. {bitstruct-8.22.1 → bitstruct-8.23.0}/docs/make.bat +0 -0
  14. {bitstruct-8.22.1 → bitstruct-8.23.0}/pyproject.toml +0 -0
  15. {bitstruct-8.22.1 → bitstruct-8.23.0}/setup.cfg +0 -0
  16. {bitstruct-8.22.1 → bitstruct-8.23.0}/setup.py +0 -0
  17. {bitstruct-8.22.1 → bitstruct-8.23.0}/src/bitstruct/bitstream.c +0 -0
  18. {bitstruct-8.22.1 → bitstruct-8.23.0}/src/bitstruct/bitstream.h +0 -0
  19. {bitstruct-8.22.1 → bitstruct-8.23.0}/src/bitstruct.egg-info/SOURCES.txt +0 -0
  20. {bitstruct-8.22.1 → bitstruct-8.23.0}/src/bitstruct.egg-info/dependency_links.txt +0 -0
  21. {bitstruct-8.22.1 → bitstruct-8.23.0}/src/bitstruct.egg-info/top_level.txt +0 -0
  22. {bitstruct-8.22.1 → bitstruct-8.23.0}/tests/__init__.py +0 -0
  23. {bitstruct-8.22.1 → bitstruct-8.23.0}/tests/test_bitstruct.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitstruct
3
- Version: 8.22.1
3
+ Version: 8.23.0
4
4
  Summary: This module performs conversions between Python values and C bit field structs represented as Python byte strings.
5
5
  Author: Ilya Petukhov
6
6
  Author-email: Erik Moqvist <erik.moqvist@gmail.com>
@@ -1,4 +1,4 @@
1
- __version__ = '8.22.1'
1
+ __version__ = '8.23.0'
2
2
 
3
3
  import binascii
4
4
  import re
@@ -925,6 +925,13 @@ static struct info_t *parse_format(PyObject *format_obj_p)
925
925
  return (NULL);
926
926
  }
927
927
 
928
+ if (number_of_bits > (INT_MAX - info_p->number_of_bits)) {
929
+ PyErr_SetString(PyExc_ValueError, "Format too long.");
930
+ PyMem_RawFree(info_p);
931
+
932
+ return (NULL);
933
+ }
934
+
928
935
  info_p->number_of_bits += number_of_bits;
929
936
  }
930
937
 
@@ -2598,6 +2605,14 @@ PyMODINIT_FUNC PyInit_c(void)
2598
2605
  return (NULL);
2599
2606
  }
2600
2607
 
2608
+ #ifdef Py_GIL_DISABLED
2609
+ if (PyUnstable_Module_SetGIL(module_p, Py_MOD_GIL_NOT_USED) < 0) {
2610
+ Py_DECREF(module_p);
2611
+
2612
+ return (NULL);
2613
+ }
2614
+ #endif
2615
+
2601
2616
  Py_INCREF(&compiled_format_type);
2602
2617
 
2603
2618
  if (PyModule_AddObject(module_p,
@@ -2609,6 +2624,8 @@ PyMODINIT_FUNC PyInit_c(void)
2609
2624
  return (NULL);
2610
2625
  }
2611
2626
 
2627
+ Py_INCREF(&compiled_format_dict_type);
2628
+
2612
2629
  if (PyModule_AddObject(module_p,
2613
2630
  "CompiledFormatDict",
2614
2631
  (PyObject *)&compiled_format_dict_type) < 0) {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitstruct
3
- Version: 8.22.1
3
+ Version: 8.23.0
4
4
  Summary: This module performs conversions between Python values and C bit field structs represented as Python byte strings.
5
5
  Author: Ilya Petukhov
6
6
  Author-email: Erik Moqvist <erik.moqvist@gmail.com>
@@ -253,6 +253,12 @@ class CTest(unittest.TestCase):
253
253
  size = calcsize('b1s6u7u9P1t8')
254
254
  self.assertEqual(size, 32)
255
255
 
256
+ # The total number of bits does not fit in an int.
257
+ with self.assertRaises(ValueError) as cm:
258
+ calcsize('p214748369' * 20)
259
+
260
+ self.assertEqual(str(cm.exception), 'Format too long.')
261
+
256
262
  def test_compiled_calcsize(self):
257
263
  """Calculate size.
258
264
 
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