[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-06-03 Thread Petr Viktorin
Petr Viktorin added the comment: I've posted a patch that fixes the remaining refleak in issue24373. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268 ___

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: I'm seeing crashes with this assertion in Cython test modules: python: ./Python/importdl.c:75: get_encoded_name: Assertion `(((PyObject*)(encoded))-ob_refcnt) == 1' failed. The problem seems to be that the module name is only one character long (a), and

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: Patch LGTM and it fixes the problem (tried it on my side). Please make sure it gets applied in time for beta 2. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-29 Thread Petr Viktorin
Petr Viktorin added the comment: Ah, indeed. I need to create a new bytes object here after all. Here is a fix, with a test. Thank you Stefan! -- Added file: http://bugs.python.org/file39546/fix-short-names.patch ___ Python tracker

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-29 Thread Petr Viktorin
Petr Viktorin added the comment: I've opened issue24328 for that regression. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268 ___ ___

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-29 Thread Petr Viktorin
Petr Viktorin added the comment: And, the remaining refleak is a known issue from 2012: PyType_FromSpec-created types with custom tp_dealloc leak references when instantiated. See issue 16690 There's more discussion is in issue 15653 Martin v. Löwis notes: So I'd propose that it is actually

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-28 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268 ___ ___ Python-bugs-list

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-26 Thread Nick Coghlan
Nick Coghlan added the comment: I registered the fix for importing extension modules from packages against issue 24285 in the commit and NEWS file rather than against this original implementation RFE. Commit references in http://bugs.python.org/issue24285#msg244098 -- resolution: -

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-25 Thread Petr Viktorin
Petr Viktorin added the comment: Yes, you did find an error. Thanks for reporting it! Here is a fix with a test case. -- Added file: http://bugs.python.org/file39493/fix-pep489-submodule.patch ___ Python tracker rep...@bugs.python.org

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-25 Thread Ronald Oussoren
Ronald Oussoren added the comment: See issue 24285, I ran into the same issue as mention in msg244008. That issue has a patch. -- nosy: +ronaldoussoren ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-25 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Yes, you did find an error. Thanks for reporting it! Here is a fix with a test case. Thanks, I was unsure if there would have been side effect or other things to fix. I would have submitted a patch otherwise. Thanks. --

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-24 Thread Matthias Bussonnier
Matthias Bussonnier added the comment: Hi, Since the last few patches related to this, I seem to have an issue with `Python/importdl.c:get_encoded_name` (I guess) sometime returning the name with a leading dot. This lead to `PyInit_.modulename` being searched which fails. My C-foo is

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Mark Lawrence
Mark Lawrence added the comment: FTR I've now built everything successfully. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268 ___ ___

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Petr Viktorin
Petr Viktorin added the comment: Thank you, Steve. A similar problem is on other platforms as well. This patch should fix it; could someone look at it? -- Added file: http://bugs.python.org/file39477/fix-dynload-init-name.patch ___ Python tracker

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Steve Dower
Steve Dower added the comment: That patch looks good to me. Totally didn't think to look for copy-paste issues... -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268 ___

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Larry Hastings
Larry Hastings added the comment: If it makes sense, can you guys check it in soon, like in real-time here? I tag 3.5 beta 1 in about an hour, and since this is a bug-fix it's legitimate to go in. -- ___ Python tracker rep...@bugs.python.org

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Steve Dower
Steve Dower added the comment: I think it's missing PyAPI_DATA, as it's probably supposed to be an external reference than a declaration. If it builds fine now, I'll commit that, but whoever made the change should confirm that's what it is supposed to be. --

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Steve Dower
Steve Dower added the comment: It also required updating PC/python3.def to put the new functions into the stable API. This is the reason we should auto-gen that file (+Zach), to make sure that anything people can #include under the limited ABI can actually be used. Just double checking all

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset af167a62e2a3 by Steve Dower in branch 'default': Issue #24268: Adds PyModuleDef_Init and PyModuleDef_Type to python3.def (stable ABI) https://hg.python.org/cpython/rev/af167a62e2a3 -- ___ Python tracker

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Petr Viktorin
Petr Viktorin added the comment: Steve, could you please merge it? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268 ___ ___ Python-bugs-list

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7b5f5f8b26a6 by Steve Dower in branch 'default': Issue #24268: Fix import naming when loading extension modules. Patch by Petr Viktorin. https://hg.python.org/cpython/rev/7b5f5f8b26a6 -- ___ Python

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Mark Lawrence
Mark Lawrence added the comment: error C2079: 'PyModuleDef_Type' uses undefined struct '_typeobject' c:\cpython\include\moduleobject.h is occurring on both 32 and 64 bit release builds on Windows 8.1 VS2015. I don't know what is causing it but figured I'd better flag it up pronto, and as you

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks for getting the Windows side sorted out folks, and my apologies for the breakage. The overlap between the current import system maintainers and Windows developers is unfortunately the null set :( -- ___ Python

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Steve Dower
Steve Dower added the comment: Since you're up, any chance you can help diagnose these test failures: Traceback (most recent call last): File D:\buildarea\3.x.bolen-windows8\build\lib\test\test_importlib\extension\test_loader.py, line 93, in setUp assert self.spec AssertionError From

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Steve Dower
Steve Dower added the comment: Actually, that probably means we're not building a new extension module on Windows, right? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268 ___

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 42ec976f627e by Steve Dower in branch 'default': Issue #24268: Adds PCBuild project to build _testmultiphase module. https://hg.python.org/cpython/rev/42ec976f627e -- ___ Python tracker

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Steve Dower
Steve Dower added the comment: Confirmed that when we build the module needed by the test, the test works fine :) Unfortunately, I think it missed the branch for b1, so people who install and run the test suite will see failures there. I'll make sure it gets into the 3.5 branch once that

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Petr Viktorin
Petr Viktorin added the comment: And here are all changes in a single patch. -- keywords: +patch Added file: http://bugs.python.org/file39471/pep0489.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24268

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Petr Viktorin
New submission from Petr Viktorin: Here is the implementation for the recently accepted PEP 489. Tested on Linux. -- files: pep0489.patches messages: 243893 nosy: encukou, eric.snow, ncoghlan priority: normal severity: normal status: open title: PEP 489 -- Multi-phase extension module

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: I'll get this merged tonight so we make the beta1 deadline, but I expect the initial docs to be fairly rudimentary and requiring further updates. -- assignee: - ncoghlan versions: +Python 3.5 ___ Python tracker

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: Regarding the extraneous whitespace changes in modsupport.h, those are courtesy of running make patchcheck as part of preparing the commit. -- ___ Python tracker rep...@bugs.python.org

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: Attached patch is the one I'm looking to commit, but -R 3:3 shows significant reference leaks in test_importlib, and possible problems in other tests as well. I'm about to revert it to see if there were any pre-existing refleak issues before applying this.

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: Initial implementation checked in at https://hg.python.org/cpython/rev/e729b946cc03 Larry, FYI regarding the refleak in test_importlib I just committed: as described in the commit message, I'm pretty sure it's a real refleak in the current PEP 489

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7f2e6f236202 by Nick Coghlan in branch 'default': Issue #24268: Address some PEP 489 refleaks https://hg.python.org/cpython/rev/7f2e6f236202 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Petr Viktorin
Petr Viktorin added the comment: FWIW, the remaining refleak occurs when unloading an extension module object. This is something that wasn't possible before PEP 489 -- extension modules were never deleted. -- ___ Python tracker

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks, that reduces the refleaks shown for ./python -m test -R3:3 test_importlib from 102 to 50 for me. However, I suspect there may still be a leak in the machinery, as I'm still seeing the total number of objects growing when importing the array module and

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset a811f5561c99 by Steve Dower in branch 'default': Issue #24268: Fixes generation of init import name on Windows. https://hg.python.org/cpython/rev/a811f5561c99 -- ___ Python tracker rep...@bugs.python.org

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Steve Dower
Steve Dower added the comment: For the sake of getting things running again, I went ahead and fixed the format string in dynload_win.c. Feel free to change it again if that isn't what was intended. -- nosy: +steve.dower ___ Python tracker

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Petr Viktorin
Petr Viktorin added the comment: Fix some refleaks - one in PyModule_FromDefAndSpec2 - this is my fault - one in PyType_FromSpecWithBases - I guess this is the first time PEP-384 built-in types are GC'd - one in the new PEP 489 tests There's still one more in the new testing module,

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: Once we sort these out, any that impact Python 3.4 (like the PyType_FromSpecAndBases one) should be backported to the maintenance branch. I wouldn't assume the one you found in PyType_FromSpecAndBases is the only one, though - I believe the tests for this PEP

[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-23 Thread Petr Viktorin
Petr Viktorin added the comment: The array module is good if you *really* drop references: $ ./python -X showrefcount Python 3.5.0a4+ (default, May 23 2015, 16:44:38) [GCC 4.9.2 20150212 (Red Hat 4.9.2-6)] on linux Type help, copyright, credits or license for more information. import sys, gc