Issue 1093253: Refactoring Python/import.c - Python tracker (original) (raw)

Created on 2004-12-30 12:50 by theller, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
import.c.patch theller,2004-12-30 12:50 Refactoring of Python/import.c
import.c.patch2 theller,2005-01-04 19:20 Second patch
import.c theller,2005-01-06 20:17 Complete, patched Python/import.c
Messages (9)
msg47413 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2004-12-30 12:50
This patch refactores Python/import.c. find_module() was changed to return an PyObject* pointer which contains the module's pathname, instead of filling out a char* buffer. load_module() accepts the PyObject* pathname instead of a char*. The patch is probably missing some error checking, and the 8 character hack for loading extensions on OS2 is not implemented, but the test case runs without errors on Windows XP pro. If a change in spirit of this patch is accepted, I'm willing to further work on it so that eventually unicode entries on sys.path, which can not be encoded with the default file system encodings, will work as expected (currently they don't). See also: http://mail.python.org/pipermail/python-list/2004-December/256969.html
msg47414 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-12-31 13:57
Logged In: YES user_id=6656 Applied the patch and built on OS X. This was the result: $ ./python.exe 'import site' failed; use -v for traceback ../Python/import.c:1496: failed assertion `dirlen <= MAXPATHLEN' Abort trap dirlen is 796092779, which seems fishy :) An uninitialized variable, maybe? Haven't looked, really...
msg47415 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2004-12-31 14:11
Logged In: YES user_id=11105 Yes, I overlooked that the initialization of the variables is inside an #if defined(MS_WINDOWS) block. Probably it would be better to leave the signature of case_ok() as before and call it through a wrapper which converts the arguments. I will prepare a new patch in a few days.
msg47416 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-12-31 14:17
Logged In: YES user_id=6656 Perhaps there should be multiple implementations of case_ok ... i.e. #if PLAT1 int case_ok(...) { ... } #elif PLAT2 int case_ok(...) { ... } #endif the current spaghetti is confusing, even by the standards of import.c...
msg47417 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2005-01-04 19:20
Logged In: YES user_id=11105 New patch attached with multiple implementations of case_ok, and more error checking: import.c.patch2 Slightly tested on OSX, Linux, Windows. The case_ok function still needs to be fixed for RISCOS (which I cannot test).
msg47418 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2005-01-06 20:17
Logged In: YES user_id=11105 For easier reading, I've attached the complete, new Python/import.c file.
msg47419 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2005-01-06 20:20
Logged In: YES user_id=11105 Martin, this is the first step for making unicode entries on sys.path work the way that is expected on Windows. You requested patches, so please take a look, if you have time. Otherwise, unassign yourself.
msg47420 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2005-05-04 18:43
Logged In: YES user_id=11105 Unassigning from MvL.
msg47421 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2005-08-10 11:05
Logged In: YES user_id=11105 Self rejecting. The patch is out of date now, and there seems zero interest in it.
History
Date User Action Args
2022-04-11 14:56:08 admin set github: 41378
2004-12-30 12:50:06 theller create