Re: [Python-Dev] Draft PEP: Simplified Package Layout and Partitioning

2011-07-22 Thread Greg Ewing
Antoine Pitrou wrote: The additional confusion lies in the fact that a module can be shadowed by something which is not a module (a mere global variable). I find it rather baffling. I think we're stuck with that as long as we use the same syntax for importing a submodule and importing a

Re: [Python-Dev] Draft PEP: Simplified Package Layout and Partitioning

2011-07-22 Thread Greg Ewing
P.J. Eby wrote: from x import y means import x; y = x.y. It actually means slightly more that that if y is a submodule, in which case it means import x.y; y = x.y. -- Greg ___ Python-Dev mailing list Python-Dev@python.org

[Python-Dev] Import lock considered mysterious

2011-07-22 Thread Greg Ewing
I recently encountered a very mysterious bug in which a background thread would inexplicably hang while attempting to make a connection using httplib. Debugging as far as I could at the Python level led to the surprising conclusion that it was hanging while using the ascii codec to encode the

Re: [Python-Dev] Python launcher command line usage (Was: 3.2.1 encoding surprise)

2011-07-22 Thread Michael Foord
On 22/07/2011 02:30, Vlad Riscutia wrote: If versioned filenames are added in addition to python.exe, it still might look confusing for most users: Why do I have python and python3.2 executables? What's the difference? I'd rather go with -v argument either way, for people that /know/ they want

Re: [Python-Dev] Import lock considered mysterious

2011-07-22 Thread Cameron Simpson
On 22Jul2011 21:29, Greg Ewing greg.ew...@canterbury.ac.nz wrote: [...] | This whole episode seems to have resulted from a collision | between two rather obscure things: that import statements | involve locking things, Necessary to avoid performing the module definitons twice when a module is

Re: [Python-Dev] Import lock considered mysterious

2011-07-22 Thread Paul Moore
On 22 July 2011 10:29, Greg Ewing greg.ew...@canterbury.ac.nz wrote: The reason for *that* was that my main module was a stub that imported the real main module, which did all its work directly from the module code. So the whole program was effectively running inside an import statement and

Re: [Python-Dev] Import lock considered mysterious

2011-07-22 Thread Antoine Pitrou
On Fri, 22 Jul 2011 21:29:23 +1200 Greg Ewing greg.ew...@canterbury.ac.nz wrote: This whole episode seems to have resulted from a collision between two rather obscure things: that import statements involve locking things, and that some fairly innocuous looking calls, such as

Re: [Python-Dev] Python launcher command line usage (Was: 3.2.1 encoding surprise)

2011-07-22 Thread Brian Curtin
On Thu, Jul 21, 2011 at 20:30, Vlad Riscutia riscutiav...@gmail.com wrote: If versioned filenames are added in addition to python.exe, it still might look confusing for most users: Why do I have python and python3.2 executables? What's the difference? I'd rather go with -v argument either

Re: [Python-Dev] Import lock considered mysterious

2011-07-22 Thread Nick Coghlan
On Fri, Jul 22, 2011 at 7:29 PM, Greg Ewing greg.ew...@canterbury.ac.nz wrote: Is it really necessary to hold the import lock for so long? Presumably the import lock is there to protect access to things like sys.modules. Is that all? Could it be released after the module code is loaded and

Re: [Python-Dev] Import lock considered mysterious

2011-07-22 Thread P.J. Eby
At 02:48 PM 7/22/2011 +0200, Antoine Pitrou wrote: See http://bugs.python.org/issue9260 There's a patch there but it needs additional sophistication to remove deadlocks when doing concurrent circular imports. I don't think that approach can work, as PEP 302 loaders can currently assume the

Re: [Python-Dev] Import lock considered mysterious

2011-07-22 Thread Antoine Pitrou
See http://bugs.python.org/issue9260 There's a patch there but it needs additional sophistication to remove deadlocks when doing concurrent circular imports. I don't think that approach can work, as PEP 302 loaders can currently assume the global import lock is being held when they

Re: [Python-Dev] Python launcher command line usage (Was: 3.2.1 encoding surprise)

2011-07-22 Thread Vlad Riscutia
OK then. I don't have a *strong* opinion against it, just thought that most people have one version of Python, maybe 2 versions as in 2.x and 3.x, so I would understand python2.exe, python3.exe but yeah, it's not that big of a deal either way. Thank you, Vlad On Fri, Jul 22, 2011 at 6:41 AM,

Re: [Python-Dev] 3.2.1 encoding surprise

2011-07-22 Thread Glenn Linderman
On 7/21/2011 5:44 PM, Mark Hammond wrote: On 22/07/2011 9:02 AM, Glenn Linderman wrote: Bad logic is get_configured_value! get_configured_value only looks in the global configuration file if there is a local configuration file that doesn't have the setting. It should look in the global