You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On Windows, the _freeze_importlib tool is not built, so it's not possible to refresh the file Python/importlib.h, which makes development on the importlib very difficult on Windows.
The Makefile contains the rules below, it's probably necessary to implement a similar behavior in a new build project:
shouldn't be too hard to add, I'll give it a go soon.
kristjanvalur commented on Jul 27, 2012
kristjanvalurmannequin
Mannequin
More actions
Here's a patch. A new project, _freeze_importlib, has the necessary prerequisites and runs the executable, generating importlib.h, as a post-build step.
I'm not sure if we should make this project a pre-requisite of any other projects, though
IMO dependencies is not a big issue here. In the worst case, the developer can build a second time...
I think your patch won't work on Unix machines: _freeze_importlib.c is linked with all Python files *except* frozen.c which defines PyImport_FrozenModules. #ifdef should be used IMO.
Also, I noticed that the marshalled code is different. The first difference a 32bit vs. 64bit issue: 0xFFFFFFFF is marshalled as a TYPE_INT64 on 64bit platforms, but as a TYPE_LONG on 32bit platforms. See bpo-15466.
kristjanvalur commented on Jul 27, 2012
kristjanvalurmannequin
Mannequin
More actions
Thank you. I see how I must change the linkage on PC Only, although I wonder why tuen unix version isn't simply doing something similar..
The marshaled code was indeed created using 64 bits. I was unsure whether to include that file as part of the patch, perhaps I shouldn't.
(Sorry for the previous message, it was wrong, and I also pressed the wrong button...)
A Unix Makefile cannot stand circular dependencies, so _freezeimportlib.c cannot depend on frozen.o. OTOH it's not simple to have almost-similar list of files on VS projects (here we need all-of-python-but-frozen.c), so your solution is not bad either.
Please check that python33.dll is not always rebuilt each time you hit F7, though.
The last commits should address Amaury's concerns. _freeze_importlib must now be built manually, followed by a build of pythoncore.
Interestingly, the builds failed only once. When rebuilding, the builds succeeded as no attempt to build freeze_importlib was made. After the last change to freeze_importlib, they again built it, and that seems to work now.
Activity
amauryfa commentedon Jul 23, 2012
On Windows, the _freeze_importlib tool is not built, so it's not possible to refresh the file Python/importlib.h, which makes development on the importlib very difficult on Windows.
The Makefile contains the rules below, it's probably necessary to implement a similar behavior in a new build project:
Modules/_freeze_importlib: Modules/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN)
$(LINKCC) $ (PY_LDFLAGS) -o $@ Modules/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $ (LIBS) $(MODLIBS) $ (SYSLIBS) $(LDLAST)
Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Modules/_freeze_importlib.c
$(MAKE) Modules/_freeze_importlib
./Modules/_freeze_importlib \
$(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h
kristjanvalur commentedon Jul 25, 2012
shouldn't be too hard to add, I'll give it a go soon.
kristjanvalur commentedon Jul 27, 2012
Here's a patch. A new project, _freeze_importlib, has the necessary prerequisites and runs the executable, generating importlib.h, as a post-build step.
I'm not sure if we should make this project a pre-requisite of any other projects, though
amauryfa commentedon Jul 27, 2012
IMO dependencies is not a big issue here. In the worst case, the developer can build a second time...
I think your patch won't work on Unix machines: _freeze_importlib.c is linked with all Python files *except* frozen.c which defines PyImport_FrozenModules. #ifdef should be used IMO.
Also, I noticed that the marshalled code is different. The first difference a 32bit vs. 64bit issue: 0xFFFFFFFF is marshalled as a TYPE_INT64 on 64bit platforms, but as a TYPE_LONG on 32bit platforms. See bpo-15466.
kristjanvalur commentedon Jul 27, 2012
Thank you. I see how I must change the linkage on PC Only, although I wonder why tuen unix version isn't simply doing something similar..
The marshaled code was indeed created using 64 bits. I was unsure whether to include that file as part of the patch, perhaps I shouldn't.
I'll wait for an update for the 64 bit issue.
amauryfa commentedon Jul 27, 2012
(Sorry for the previous message, it was wrong, and I also pressed the wrong button...)
A Unix Makefile cannot stand circular dependencies, so _freezeimportlib.c cannot depend on frozen.o. OTOH it's not simple to have almost-similar list of files on VS projects (here we need all-of-python-but-frozen.c), so your solution is not bad either.
Please check that python33.dll is not always rebuilt each time you hit F7, though.
pitrou commentedon Jul 27, 2012
I don't think it's necessary, it's a pretty minor issue since the generated bytecode is portable anyway.
python-dev commentedon Jul 28, 2012
New changeset fe29a657bde9 by Martin v. Löwis in branch 'default':
Issue bpo-15431: Add _freeze_importlib project to regenerate importlib.h on Windows.
http://hg.python.org/cpython/rev/fe29a657bde9
loewis commentedon Jul 28, 2012
Thanks for the patch, committed with slight modifications.
amauryfa commentedon Jul 28, 2012
Comments about PyImport_FrozenModules linkage have not been addressed. Now the build is failing on all Unix machines...
pitrou commentedon Jul 28, 2012
To be clear, the build fails when importlib needs to be frozen again:
python-dev commentedon Jul 28, 2012
New changeset 7967cb63e50e by Martin v. Löwis in branch 'default':
Issue bpo-15431: Declare PyImport_FrozenModules conditionally on Unix only.
http://hg.python.org/cpython/rev/7967cb63e50e
python-dev commentedon Jul 28, 2012
New changeset deb421baf671 by Martin v. Löwis in branch 'default':
Issue bpo-15431: Drop _freeze_importlib from all build configurations,
http://hg.python.org/cpython/rev/deb421baf671
loewis commentedon Jul 28, 2012
The last commits should address Amaury's concerns. _freeze_importlib must now be built manually, followed by a build of pythoncore.
Interestingly, the builds failed only once. When rebuilding, the builds succeeded as no attempt to build freeze_importlib was made. After the last change to freeze_importlib, they again built it, and that seems to work now.
Tentatively closing the issue again.