Skip to content

Commit 46a0946

Browse files
committed
Fix packaging for cPickle. Fix tests.
1 parent 8c02697 commit 46a0946

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
long_description="""Examples of good and bad practice with Python C Extensions.""",
5656
long_description_content_type='text/plain',
5757
platforms=['Mac OSX', 'POSIX', ],
58+
packages=[PACKAGE_NAME,],
5859
classifiers=[
5960
'Development Status :: 5 - Production/Stable',
6061
'Environment :: Console',

src/cpy/Pickle/cCustomPickle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ static PyMethodDef Custom_methods[] = {
219219

220220
static PyTypeObject CustomType = {
221221
PyVarObject_HEAD_INIT(NULL, 0)
222-
.tp_name = "cPickle.Custom",
222+
.tp_name = "cPyExtPatt.cPickle.Custom",
223223
.tp_doc = "Custom objects",
224224
.tp_basicsize = sizeof(CustomObject),
225225
.tp_itemsize = 0,

tests/unit/test_c_custom_pickle.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@ def test_pickle_getstate():
1616
pickled_value = pickle.dumps(custom)
1717
print()
1818
print(f'Pickled original is {pickled_value}')
19-
assert pickled_value == b''
19+
assert pickled_value == (b'\x80\x04\x95f\x00\x00\x00\x00\x00\x00\x00\x8c\x12cPyExtPatt.cPickle\x94'
20+
b'\x8c\x06Custom\x94\x93\x94)\x81\x94}\x94(\x8c\x05first\x94\x8c\x05FIRST'
21+
b'\x94\x8c\x04last\x94\x8c\x04LAST\x94\x8c\x06number\x94K\x0b\x8c\x0f_pickle_'
22+
b'version\x94K\x01ub.')
2023
# result = pickle.loads(pickled_value)

0 commit comments

Comments
 (0)