[issue16991] Add OrderedDict written in C

2015-06-02 Thread Stefan Krah
Stefan Krah added the comment: It's fine to open other issues, but I'm not happy with the resize()/get_index() situation. Currently I can't come up even with an informal proof that it'll always work (and see #24361). I think these functions really *need* 100% code coverage. --

[issue16991] Add OrderedDict written in C

2015-06-02 Thread Eric Snow
Eric Snow added the comment: Addressing the concerns with resize()/get_index() is next on my list. I had meant to open up an issue on it last night but it was getting pretty late for me and it slipped my mind. I've opened issue24362 to track that work. --

[issue16991] Add OrderedDict written in C

2015-06-01 Thread Stefan Krah
Changes by Stefan Krah ste...@bytereef.org: Added file: http://bugs.python.org/file39582/crash-2.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-06-01 Thread Stefan Krah
Stefan Krah added the comment: crash-1.py is due to an unchecked return value from _odictnode_VALUE(). We should probably use PyDict_GetItemWithError(), also in other places. I normally try to steer clear of stylistic remarks, but the _odictnode* macros are hiding too many things. As of now,

[issue16991] Add OrderedDict written in C

2015-06-01 Thread Stefan Krah
Changes by Stefan Krah ste...@bytereef.org: Added file: http://bugs.python.org/file39581/crash-1.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-06-01 Thread Stefan Krah
Stefan Krah added the comment: crash-2.py is due to the fact that _PyDict_Pop() deletes a reference to 'key' in _odict_popkey(). The INCREF(key) in popitem should take place before calling _odict_popkey(). Again, I don't see the point of INCREF/DECREF *inside* of _odict_popkey(). --

[issue16991] Add OrderedDict written in C

2015-06-01 Thread Eric Snow
Eric Snow added the comment: I've opened the following issues to address the 3 last comments: issue24347 issue24348 issue24349 I'll be opening a separate issue for outstanding review comments. -- status: open - closed ___ Python tracker

[issue16991] Add OrderedDict written in C

2015-06-01 Thread Christian Heimes
Christian Heimes added the comment: Coverity has found an issue in odict, too: *** CID 1302699: Null pointer dereferences (NULL_RETURNS) /Objects/odictobject.c: 1316 in odict_copy() 1310 od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL); 1311 if

[issue16991] Add OrderedDict written in C

2015-06-01 Thread Eric Snow
Eric Snow added the comment: @Jim and Stefan, Thanks for thorough reviews! @Stefan, I'll take a look at those crashers and other suggestions ASAP. I really appreciate you taking the time. Now that the patch has been landed, would you mind opening new issues for each problem you find? That

[issue16991] Add OrderedDict written in C

2015-06-01 Thread Steve Dower
Changes by Steve Dower steve.do...@microsoft.com: -- nosy: -steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___

[issue16991] Add OrderedDict written in C

2015-05-31 Thread Stefan Krah
Stefan Krah added the comment: Opening again. I have too many questions. :) -- nosy: +skrah status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Eric Snow added the comment: If it's just a matter of adding the definitions then here's a patch. Does that look correct? -- Added file: http://bugs.python.org/file39567/odict-windows.diff ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset aea27164d207 by Eric Snow in branch '3.5': Issue #16991: Add odictobject.h on Windows. https://hg.python.org/cpython/rev/aea27164d207 -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset c9404fba02ba by Eric Snow in branch '3.5': Issue #16991: Properly handle return values in several places. https://hg.python.org/cpython/rev/c9404fba02ba New changeset 951a3ef82180 by Eric Snow in branch '3.5': Issue #16991: Do not return None from

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset fbe74badb0c6 by Eric Snow in branch 'default': Issue #16991: Ensure that the proper OrderedDict is used in tests. https://hg.python.org/cpython/rev/fbe74badb0c6 -- ___ Python tracker

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset 030205f1e716 by Eric Snow in branch '3.5': Issue #16991: Fix a few leaks and other memory-related concerns in OrderedDict. https://hg.python.org/cpython/rev/030205f1e716 -- ___ Python tracker

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3ba1fa925f17 by Eric Snow in branch 'default': Issue #16991: Use the correct version for master. https://hg.python.org/cpython/rev/3ba1fa925f17 -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Eric Snow added the comment: Well, that last one has everything compiling again. I expect it should be okay now. I'll watch the results. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Eric Snow added the comment: I'm checking a fix for Windows against a buildbot (http://buildbot.python.org/all/builders/AMD64%20Windows8%203.x). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Eric Snow added the comment: You already added public name Py_ODict_GetItemId. It uses private _Py_Identifier API and shouldn't be public. Ah. I'll remove it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7117e9b0f595 by Eric Snow in branch '3.5': Issue #16991: Drop Py_ODict_GetItemId. https://hg.python.org/cpython/rev/7117e9b0f595 -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Eric Snow added the comment: That last message is about building on Windows. -- nosy: +steve.dower ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset 1d851112922f by Eric Snow in branch '3.5': Issue #16991: Add PyODict* to Windows builds. https://hg.python.org/cpython/rev/1d851112922f -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I agree with all Stephan's comments on Rietveld. See also issue24115 that fixed bugs similar to found in C implementation of OrderedDict. -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0a7380984e37 by Eric Snow in branch '3.5': Issue #16991: Use PyObject_TypeCheck instead of PyObject_IsInstance. https://hg.python.org/cpython/rev/0a7380984e37 -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Mark Lawrence
Mark Lawrence added the comment: I'm getting the following linker errors on Windows 8.1 for 32 and 64 bit debug and release builds. unresolved external symbol _PyODict_Type in C:\cpython\PCbuild\_collectionsmodule.obj, and _PyODictIter_Type, _PyODictValues_Type,

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Eric Snow added the comment: PyObject_TypeCheck() should be used instead of PyObject_IsInstance() (see issue24257). Thanks for pointing this out. I've fixed both dictobject.h and odictobject.h. Perhaps Py_ODict_GetItemId() should be private API as relevant dict function. This isn't

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Eric Snow added the comment: New changeset 0a7380984e37 by Eric Snow in branch '3.5': Issue #16991: Use PyObject_TypeCheck instead of PyObject_IsInstance. https://hg.python.org/cpython/rev/0a7380984e37 I've also merged this into default: changeset:

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Eric Snow
Eric Snow added the comment: I'm getting the following linker errors on Windows 8.1 for 32 and 64 bit debug and release builds. unresolved external symbol _PyODict_Type in C:\cpython\PCbuild\_collectionsmodule.obj, and _PyODictIter_Type, _PyODictValues_Type,

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This isn't needed for 3.5, right? I'm not opposed to adding more functions to the C API for OrderedDict, but I wanted to start out as small as possible. You already added public name Py_ODict_GetItemId. It uses private _Py_Identifier API and shouldn't be

[issue16991] Add OrderedDict written in C

2015-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: As for Windows issue, perhaps these names should be enumerated in PC/python3.def? See also issue23903. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: Added file: http://bugs.python.org/file39566/0813b1a88171.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Eric Snow
Eric Snow added the comment: @Jim, I believe I've addressed all the review comments that have indicate a risk. I've also answered basically all the rest. Thanks for the great review. Unless there are any objections, I'll likely commit the patch in the next hour or two. --

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset e7af362b78df by Eric Snow in branch 'default': Issue #16991: Add a C implementation of collections.OrderedDict. https://hg.python.org/cpython/rev/e7af362b78df -- nosy: +python-dev ___ Python tracker

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Eric Snow
Eric Snow added the comment: Yep. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset b85028c9d4b9 by Eric Snow in branch '3.5': Issue #16991: Add a C implementation of collections.OrderedDict. https://hg.python.org/cpython/rev/b85028c9d4b9 -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: @Eric: I think you also want to commit it to 3.5 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Eric Snow
Eric Snow added the comment: I'll keep an eye out for trouble on the buildbots. -- resolution: - fixed stage: patch review - resolved status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PyObject_TypeCheck() should be used instead of PyObject_IsInstance() (see issue24257). Perhaps Py_ODict_GetItemId() should be private API as relevant dict function. -- status: pending - open ___ Python tracker

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Eric Snow
Eric Snow added the comment: Planning on committing today after I address some review comments. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Wes Turner
Wes Turner added the comment: * Would this make it easy/faster to also have a DefaultOrderedDict (which can/could also be accomplished with .get(attr, []) and .setdefault ? On May 29, 2015 2:39 PM, Eric Snow rep...@bugs.python.org wrote: Eric Snow added the comment: Planning on committing

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: Can we merge this patch before new beta2? https://mail.python.org/pipermail/python-committers/2015-May/003410.html -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: * Would this make it easy/faster to also have a DefaultOrderedDict (which can/could also be accomplished with .get(attr, []) and .setdefault ? Not in 3.5. -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-26 Thread Eric Snow
Eric Snow added the comment: Eric I realize that O (1) deletion is hard, and don't see a good way around it without changing the implementation ... I just think that the preserving the current C layout may be forcing an even more complicated solution than neccessary. I am nervous

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: @Jim, You've got some good questions. I'll look into them today. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: @mrab gah! I could swear I originally had the _odict_clear_node first and had switched them due to a segfault. It even crossed my mind on Friday but I didn't pursue it. I'm guessing I did put the _odict_clear_node call first at some point but lost that fix

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: I'm going to echo the previous comment that maybe trying to emulate the existing dict implementation too carefully just adds complexity. The whole dance with _odict_get_index and _odict_resize is due to the requirement that OrderedDict maintain O(1) operation for

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: Should dictobject.h get a bit more changes? In particular, should the following be expanded? #define PyDictKeys_Check(op) (Py_TYPE(op) == PyDictKeys_Type) #define PyDictItems_Check(op) (Py_TYPE(op) == PyDictItems_Type) #define PyDictValues_Check(op)

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: @Mark, great idea. I wish we'd discussed it more at PyCon 2013 when I was working on preserving OrderedDict's O(1) deletion. :) TBH, I don't have any problems with improvements. In fact, I'd be quite happy if folks jumped in and improved what I've done or even

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Mark Shannon
Mark Shannon added the comment: I realise that I am bit late to the party, but I would like to point out that a smaller, arguably simpler, and almost certainly faster alternative design exists. This design simply consists of an array of (prev, next, key) nodes attached to the base dict. The

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: Added file: http://bugs.python.org/file39496/3b2a9026d48e.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: At present the only remaining issues with the patch are: * 10 leaked refs in test_collections * a failing test in test_enum === key: __members__ result: OrderedDict([('red', Color.red:

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: The failing test is not passing so I don't see any further blockers to committing this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: Added file: http://bugs.python.org/file39499/c3fab329aa7f.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: rather, it *is* passing now :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___ Python-bugs-list

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: I've cleaned up the patch. I still want to make one last pass to check re-entrancy concerns. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: Added file: http://bugs.python.org/file39500/ba1c6d40ca63.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: I've cleaned up all the ref leaks so now just the failing test_enum test remains to be resolved. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Jim Jewett
Jim Jewett added the comment: Eric I realize that O (1) deletion is hard, and don't see a good way around it without changing the implementation ... I just think that the preserving the current C layout may be forcing an even more complicated solution than neccessary. I am nervous about

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Yury Selivanov
Yury Selivanov added the comment: rather, it *is* passing now :) Eric, thanks for working on this! Could you please go through your patch and replace // comments with /* .. */ ones? It would also be great if you can clean-up XXX comments. --

[issue16991] Add OrderedDict written in C

2015-05-25 Thread Eric Snow
Eric Snow added the comment: Ah, good point. I'll take care of all those. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___

[issue16991] Add OrderedDict written in C

2015-05-24 Thread Matthew Barnett
Matthew Barnett added the comment: First some background: when you put a new entry into a dict, it looks for an empty slot, the key's hash determining the initial choice, but if that slot's occupied, it picks another, etc, so the key might not be in the slot of first choice. In

[issue16991] Add OrderedDict written in C

2015-05-23 Thread Matthew Barnett
Matthew Barnett added the comment: In odict_new, if _odict_initialize fails, will the dict pointed to by od_inst_dict be deallocated? In odictiter_new, there's Py_INCREF(od);. If di-di_result == NULL fails, od isn't DECREFed. -- ___ Python tracker

[issue16991] Add OrderedDict written in C

2015-05-23 Thread Eric Snow
Eric Snow added the comment: Good catch. I've fixed odictiter_new in the feature branch. However, I'm not sure there's anything to be fixed in odict_new. It follows the same pattern as dict_new (over in Objects/dictobject.c). -- ___ Python

[issue16991] Add OrderedDict written in C

2015-05-23 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- hgrepos: +309 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___ Python-bugs-list

[issue16991] Add OrderedDict written in C

2015-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: I'd suggest also taking a look into whether or not the PEP 412 keysharing might be causing problems. -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-23 Thread Eric Snow
Eric Snow added the comment: Good point, Nick. I'd checked that earlier but did not see any relationship. At this point it's worth checking again. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-23 Thread Jim Jewett
Jim Jewett added the comment: Eric, unless I'm misreading your debugging info, it is the other way around -- something is in the dict, but not in the list that you iterate over. And since the list that you iterate over looks right, I have to wonder if it was something

[issue16991] Add OrderedDict written in C

2015-05-23 Thread Jim Jewett
Jim Jewett added the comment: (Just putting my review summary in the main ticket) I'm going to echo the previous comment that maybe trying to emulate the existing dict implementation too carefully just adds complexity. The split-keys implementation shows that there is at least some

[issue16991] Add OrderedDict written in C

2015-05-23 Thread Jim Jewett
Jim Jewett added the comment: Should dictobject.h get a bit more changes? In particular, should the following be expanded? #define PyDictKeys_Check(op) (Py_TYPE(op) == PyDictKeys_Type) #define PyDictItems_Check(op) (Py_TYPE(op) == PyDictItems_Type) #define PyDictValues_Check(op) (Py_TYPE(op)

[issue16991] Add OrderedDict written in C

2015-05-22 Thread Eric Snow
Eric Snow added the comment: Include/opcode.h shouldn't be in the change (and won't be when committed). I'm guessing it being there is related to one of the recent merges I did from default into the feature branch. -- ___ Python tracker

[issue16991] Add OrderedDict written in C

2015-05-22 Thread Eric Snow
Eric Snow added the comment: If I still the following at Lib/test/test_configparser.py:328: print(len(cf._proxies), len(list(cf._proxies)), list(cf._proxies)) print(len(cf._sections), len(list(cf._sections)), list(cf._sections)) I get unexpected results that are a clear indication of a

[issue16991] Add OrderedDict written in C

2015-05-22 Thread Eric Snow
Eric Snow added the comment: Just to narrow things down a bit further, the failure happens specifically under ConfigParserTestCaseNoValue: PYTHONHASHSEED=7 ./python -m unittest test.test_configparser.ConfigParserTestCaseNoValue.test_basic -v --

[issue16991] Add OrderedDict written in C

2015-05-22 Thread Jim Jewett
Jim Jewett added the comment: Why does generated file Include/opcode.h show up as changed? It looks like pure whitespace, but I wonder if a similar whitespace change might be making something a space too long somewhere. -- nosy: +Jim.Jewett ___

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Ned Deily
Ned Deily added the comment: FWIW, the random segfault seems to be triggered by hash randomization. If I disable randomization, it does not seem to fail: for i in `seq 1 20`; do PYTHONHASHSEED=1 ./python -m test.regrtest -m test_basic test_configparser ; done Presumably, the --forever

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Eric Snow
Eric Snow added the comment: Cool. The following gives consistent failures at certain seed values: for i in `seq 1 100`; do echo $i; PYTHONHASHSEED=$i ./python -m test.regrtest -m test_basic test_configparser ; done Through 100 I get segfaults with 7, 15, 35, 37, 39, 40, 42, 47, 50, 66,

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Eric Snow
Eric Snow added the comment: Thanks for looking into this, Ned. I've changed that size_t to ssize_t which I expect will quiet that clang warning you saw. I'm glad you pointed it out because it means that that branch was never executing! Unfortunately fixing that does not solve all my

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Eric Snow
Eric Snow added the comment: I've spent a bit of time exploring the segfault. Here's some data that might help relative to the configparser test. I put the following at the beginning of _odict_resize: Py_ssize_t len = PyObject_Size((PyObject *)od); if (len == 0)

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Eric Snow
Eric Snow added the comment: Here are the last 10 frames from the backtrace (gdb): #0 0x005b15d0 in odictiter_iternext (di=optimized out) at Objects/odictobject.c:1888 #1 0x00453179 in PyIter_Next (iter=optimized out) at Objects/abstract.c:2760 #2 0x005881e7 in

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Eric Snow
Eric Snow added the comment: As far as I can tell there aren't any patterns that repeat across multiple seeds (which makes sense). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Eric Snow
Eric Snow added the comment: The segfault happens at line 1888 of odictobject.c when it tries to Py_INCREF a NULL value. The problem is that the value that gets looked up for a presumably valid key is returned as NULL. So either the value is messed up, lookup is broken, or the wrong key is

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Matthew Barnett
Matthew Barnett added the comment: FTR, in _odict_resize there's this: size_t i = _odict_get_index(od, _odictnode_KEY(node)); if (i 0) { Note that i is declared as unsigned and then tested whether it's negative. -- nosy: +mrabarnett ___

[issue16991] Add OrderedDict written in C

2015-05-21 Thread Eric Snow
Eric Snow added the comment: Yeah, Ned pointed that one out. I fixed it but haven't pushed the change. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-20 Thread Eric Snow
Eric Snow added the comment: These are the leaks I'm seeing in test_collections (14/24 tests): test_copying : 178 test_iterators : 40 test_update : 29 test_init: 22 test_move_to_end : 21 test_sorted_iterators: 20 test_setdefault : 16

[issue16991] Add OrderedDict written in C

2015-05-20 Thread Eric Snow
Eric Snow added the comment: I've updated the cordereddict branch on the feature repo to fix the ref leak on None. I'm still seeing other leaks (regrtest -R 3:3), but I don't think that should block landing before the feature freeze. However, I'm concerned about a segfault I'm seeing roughly

[issue16991] Add OrderedDict written in C

2015-05-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: A patch shouldn't be integrated if there are known bugs with it (especially segfaults). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-20 Thread Eric Snow
Eric Snow added the comment: Agreed. I wanted to be clear about what is blocking landing the patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-20 Thread Eric Snow
Eric Snow added the comment: I've fixed most of the leaks now. The only remaining ones are: test_clear : 5 test_repr_recursive : 3 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-20 Thread Eric Snow
Eric Snow added the comment: Regarding the segfault, the following does not fail: ./python -m test.regrtest --forever -m test_basic test_configparser but this does: for i in `seq 1 20`; do ./python -m test.regrtest -m test_basic test_configparser ; done --

[issue16991] Add OrderedDict written in C

2015-05-20 Thread Yury Selivanov
Yury Selivanov added the comment: Eric, could you please upload your latest patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___ ___

[issue16991] Add OrderedDict written in C

2015-05-20 Thread Eric Snow
Eric Snow added the comment: Here's a diff from the current cordereddict branch of the feature repo. -- Added file: http://bugs.python.org/file39445/cOrderedDict-4.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-18 Thread Eric Snow
Eric Snow added the comment: Thanks for taking a look, Yury. I'll follow up on the ref leak soon. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

[issue16991] Add OrderedDict written in C

2015-05-16 Thread Yury Selivanov
Yury Selivanov added the comment: As for refleak -- I looked at it briefly: simple a = OrderedDict(); a = None code leaks, so it must be somewhere in tp_new/tp_dealloc. And I know what object is leaking - it's None. -- ___ Python tracker

[issue16991] Add OrderedDict written in C

2015-05-16 Thread Yury Selivanov
Yury Selivanov added the comment: Raymond, is there any chance you can review the patch before beta1? Sorry, for bugging you with this, I just really hope we can have fast OrderedDict in 3.5. -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-16 Thread Yury Selivanov
Yury Selivanov added the comment: Started to look at the patch in more detail. Found one leak. There are more. Eric, maybe you can hunt them? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991

[issue16991] Add OrderedDict written in C

2015-05-16 Thread Yury Selivanov
Yury Selivanov added the comment: I must have used a better example :) import sys; from collections import OrderedDict as OD sys.getrefcount(None) 2053 OD();OD();OD();OD(); OrderedDict() OrderedDict() OrderedDict() OrderedDict() sys.getrefcount(None) 2057 --

[issue16991] Add OrderedDict written in C

2015-05-13 Thread Yury Selivanov
Yury Selivanov added the comment: Eric, is there any chance this can land in 3.5? OrderedDict is a heavily used thing, everyone will benefit from a fast implementation. It's OK if we have an imperfect (but fully compatible with existing OrderedDict) implementation in 3.5. We can optimize

[issue16991] Add OrderedDict written in C

2015-05-13 Thread Eric Snow
Eric Snow added the comment: @Yury, I'm mostly just waiting for Raymond to give it at least a quick sanity-check. I know there is at least 1 ref leak, but that can be sorted out. -- ___ Python tracker rep...@bugs.python.org

[issue16991] Add OrderedDict written in C

2015-05-13 Thread Eric Snow
Changes by Eric Snow ericsnowcurren...@gmail.com: -- priority: normal - release blocker ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16991 ___

  1   2   >