[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread Richard Oudkerk

Richard Oudkerk  added the comment:

>  conn = MySQLConn()
>  start_thread1(conn)
>  start_thread2(conn):
>  while True:
>if os.fork() == 0:  # child
>  raise Exception('doom')  # triggers destructor

There is no guarantee here that the lock will be held at the time of the fork.  
So even if we ensure that a lock acquired before the fork stayed lock, we won't 
necessarily get a deadlock.

More importantly, you should never fork without ensuring that you exit with 
os._exit() or os.exec*().  So your example should be something like

  conn = MySQLConn()
  start_thread1(conn)
  start_thread2(conn):
  while True:
if os.fork() == 0:  # child
  try:
raise Exception('doom')  # does NOT trigger destructor
  except:
sys.excepthook(*sys.exc_info())
os._exit(1)
  else:
os._exit(0)

With this hard exit the destructor never runs.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3665] Support \u and \U escapes in regexes

2012-05-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file25784/3665.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3665] Support \u and \U escapes in regexes

2012-05-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file25783/re_unicode_escapes.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

We could make any later attempt to acquire or release a lock that was 
reinitialized while it was held raise an exception.

Such exception raising behavior should be conditional at lock construction 
time; some code (such as logging) never wants to deal with one because it is 
unacceptable for it to ever fail or deadlock.  It should also be possible for 
the exception to be usefully handled if caught; locks should gain an API to 
clear their internal "reinitialized while held" flag.

Q: Should .release() raise the exception?  Or just warn?  I'm thinking no 
exception on release().  Releasing a lock that was held during 
re-initialization could just reset the "reinitialized while held" flag.

The acquire() that would deadlock or crash today would be where raising an 
exception makes the most sense.

Deadlocks are unacceptable.  The whole point of this bug is that we can do 
better.  An exception would provide a stack trace of exactly which thing where 
caused the offending operation so that the code can be fixed to not misuse 
locks in the first place or that specific lock can be changed to silent 
reinitialization on fork.  (or better yet, the fork can be removed entirely)

Both behaviors are better than today.  This change would surface bugs in 
people's code much better than difficult to debug deadlocks.

It should be a pretty straightforward change to reinit_locks_2 (Patch Set 6) to 
behave that way.

Looking back, raising an exception is pretty much what I suggested in 
http://bugs.python.org/issue6721#msg94115 2.5 years ago.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3665] Support \u and \U escapes in regexes

2012-05-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Removed file: http://bugs.python.org/file25782/3665.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3665] Support \u and \U escapes in regexes

2012-05-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Removed file: http://bugs.python.org/file25781/re_unicode_escapes.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3665] Support \u and \U escapes in regexes

2012-05-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file25782/3665.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3665] Support \u and \U escapes in regexes

2012-05-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file25781/re_unicode_escapes.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3665] Support \u and \U escapes in regexes

2012-05-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't think it is worth to target it for 2.7 and 3.2 (it's new feature, not 
bugfix), but for 3.3 it will be very useful.

Since PEP 393 conversion to the surrogate pairs is no longer relevant.

--
components: +Regular Expressions, Unicode
nosy: +storchaka
type: behavior -> enhancement
versions:  -Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14973] restore python2 unicode literals in "ur" strings

2012-05-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

See issue3665.

--
nosy: +storchaka
title: restore python2 unicode literals in "ru" strings -> restore python2 
unicode literals in "ur" strings

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-05-31 Thread josmiley

josmiley  added the comment:

>>> class DerivedProp(BaseProp):
... @property
... def p(self):
... return super(DerivedProp, self).p * 2
... @p.setter
... def p(self, value):
... BaseProp.p.__set__(self,value / 2)

--
nosy: +josmiley

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14673] add sys.implementation

2012-05-31 Thread Eric Snow

Changes by Eric Snow :


Removed file: http://bugs.python.org/file25779/issue14673_full.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14673] add sys.implementation

2012-05-31 Thread Eric Snow

Eric Snow  added the comment:

Guess I should have tested the docs before posting the patch. ;)

--
Added file: http://bugs.python.org/file25780/issue14673_full.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14007] xml.etree.ElementTree - XMLParser and TreeBuilder's doctype() method missing

2012-05-31 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset a29ae1c2b8b2 by Eli Bendersky in branch 'default':
Issue #14007: make XMLParser a real subclassable type exported from 
_elementtree. +cleanups
http://hg.python.org/cpython/rev/a29ae1c2b8b2

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14673] add sys.implementation

2012-05-31 Thread Eric Snow

Eric Snow  added the comment:

This patch incorporates types.SimpleNamespace and makes the repr show all 
attributes.  Tests and docs for types.SimpleNamespace are also included.

The patch skips 3 tests (which I added) that are failing.  One has a segfault 
due to a recursive repr (where I had a hunch that something funny would 
happen).  One is a situation that I mentioned earlier in this ticket.  However, 
the third one was entiredly unexpected.

None of these pathologies impact sys.implementation.  I will be working on 
fixing them regardless.  If you want to wait until I fix the corner cases, I'm 
fine with that.  However, the patch should be good to go as far as 
sys.implementation is concerned.

--
Added file: http://bugs.python.org/file25779/issue14673_full.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14958] IDLE 3 and PEP414 - highlighting unicode literals

2012-05-31 Thread Roger Serwy

Roger Serwy  added the comment:

Attached is a backport to 2.7.

--
keywords: +patch
versions: +Python 2.7
Added file: http://bugs.python.org/file25778/issue14958_27.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14974] rename packaging.pypi to packaging.index

2012-05-31 Thread Éric Araujo

Éric Araujo  added the comment:

We could use “catalog” (see how the interest group for PyPI is named 
catalog-sig), but it sounds a bit abstract to me, and at the same time fails to 
convey that this module deals with finding things (in an index/catalog) and 
also download them (from PyPI or third-party sites).  Anyway I don’t think 
names can be perfect; just like distutils2.database may be ambiguous if one 
doesn’t know that it works with the database of installed projects, 
distutils2.index can be ambiguous if one doesn’t know that the repository of 
information (and sometimes downloads) is called an index.

+1 for distutils2.index
+0.3 for distutils2.repository (long, and mostly used with VCS these days)
±0 for distutils2.pypi

--
nosy: +eric.araujo
versions: +3rd party

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14968] Section "Inplace Operators" of :mod:`operator` should be a subsection

2012-05-31 Thread Éric Araujo

Éric Araujo  added the comment:

Good catch, +1 for the patch.

--
nosy: +eric.araujo, sandro.tosi
stage:  -> commit review
versions: +Python 2.7, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14965] super() and property inheritance behavior

2012-05-31 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo
stage:  -> needs patch
versions: +Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14950] Make packaging.install API less confusing and more extensible

2012-05-31 Thread Éric Araujo

Éric Araujo  added the comment:

BTW I suggest you work off a d2 checkout; I have not ported all changes from 
Montreal sprints to cpython/p7g at the moment.

--
title: packaging.install does not have a clear API. -> Make packaging.install 
API less confusing and more extensible

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14950] packaging.install does not have a clear API.

2012-05-31 Thread Éric Araujo

Éric Araujo  added the comment:

To summarize the high-level API needed: install from an index (argument is a 
version requirement as string), install archive file, install from directory 
(containing setup.cfg or setup.py).

When #8668 is implemented, an “editable” option will be nice too.  (Need to 
check pip doc and use cases to see if only the install from directory should 
get it.)

For the implementation, as discussed on IRC we want to go with classes to 
represent the various kinds of installable things (requirement, path to a file, 
path to a dir) and one or more high-level functions to wrap them for common 
cases (see Nick’s good article 
http://www.boredomandlaziness.org/2012/05/djangos-cbvs-are-not-mistake-but.html 
).  I would prefer having two functions, one that takes a version req and 
another one that takes a path; it’s easy to distinguish between file (archive) 
and directory but I don’t like guessing between name and path (see the not-cool 
code in pysetup actions).

--
nosy: +eric.araujo
versions: +3rd party

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14957] Improve docs for str.splitlines

2012-05-31 Thread Éric Araujo

Changes by Éric Araujo :


--
keywords: +easy
nosy: +eric.araujo
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14499] Extension module builds fail with Xcode 4.3 on OS X 10.7 due to SDK move

2012-05-31 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread lesha

lesha  added the comment:

Re "threading locks cannot be used to protect things outside of a single 
process":

The Python standard library already violates this, in that the "logging" module 
uses such a lock to protect the file/socket/whatever, to which it is writing.

If I had a magic wand that could fix all the places in the world where people 
do this, I'd accept your argument.

In practice, threading locks are abused in this way all the time.

Most people don't even think about the interaction of fork and threads until 
they hit a bug of this nature.


Right now, we are discussing a patch that will take broken code, and instead of 
having it deadlock, make it actually destroy data. 

I think this is a bad idea. That is all I am arguing.

I am glad that my processes deadlocked instead of corrupting files. A deadlock 
is easier to diagnose.


You are right: subprocess does do a hard exit on exceptions. However, the 
preexec_fn and os.fork() cases definitely happen in the wild. I've done both of 
these before.


I'm arguing for a simple thing: let's not increase the price of error. A 
deadlock sucks, but corrupted data sucks much worse -- it's both harder to 
debug, and harder to fix.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

threading locks cannot be used to protect things outside of a single process.  
Any code using them to do that is broken.

In your examples you are suggesting a class that wants to do one or more mysql 
actions within a destructor and worried that the __del__ method would be called 
in the fork()'ed child process.

With the subprocess module, this will never happen.  the child exec's or does a 
hard exit.   
http://hg.python.org/cpython/file/bd2c2def77a7/Modules/_posixsubprocess.c#l634

When someone is using os.fork() directly, they are responsible for all 
destructors in their application behaving sanely within the child process.

Destructors are an evil place to put code that does actual work and are best 
avoided.  When required, they must be written defensively because they really 
cannot depend on much of the Python execution environment around them being in 
a functional state as they have no control over _when_ they will be called 
during shutdown.  Nothing new here.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread lesha

lesha  added the comment:

Deadlocks are dandy, but corruption is cruel.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

Anyone using a preexec function in subprocess has already declared that they 
like deadlocks so that isn't an issue. :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14969] Use __suppress_context__ in contextlib.ExitStack.__exit__

2012-05-31 Thread Nick Coghlan

Nick Coghlan  added the comment:

Electronic contributor forms are actually on the PSF wishlist. We'll get there 
some day (maybe after the website update).

Getting back to the problem at hand, I think you might be on to something with 
the idea of exploiting PEP 409 to handle this. Specifically, where we reraise a 
caught exception when there are no exception details active, we should be able 
to replace the bare raise with something like:

# A containing with statement will automatically add the exception
# context back in after it gets suppressed. Avoid displaying it.
if suppressed_exc and exc_details == (None, None, None):
raise exc from None
raise

That way, the exception *display* of escaping exceptions will still match that 
of nested with statements, even though the attributes are subtly different 
(__suppress_context__ being set to True, rather than __context__ being None)

--
title: Restore sys.exc_clear()? -> Use __suppress_context__ in 
contextlib.ExitStack.__exit__

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread lesha

lesha  added the comment:

> I think forkall() on Solaris acts like that, but the normal fork() 
> function does not.  Only the thread which performs fork() will survive 
> in the child process.

Sorry, brain fail. A slightly more contrived failure case is this:

subprocess.Popen(
  ..., 
  preexec_fn=lambda: conn.doWork()
)

Everything else is the same.

Another failure case is:

  class MySQLConn:
... doWork as before ...

def __del__(self):
  self.doWork()

Followed by:

  def thread3(conn):
while True:
  subprocess.call(['nonexistent_program']) 
  time.sleep(0.1)

The destructor will fire in the child and corrupt the parent's data.

An analogous example is:

  conn = MySQLConn()
  start_thread1(conn)
  start_thread2(conn):
  while True:
if os.fork() == 0:  # child
  raise Exception('doom')  # triggers destructor

Basically, it is really really dangerous to release locks that protect any 
resources that are not copied by fork (i.e. network resources, files, DB 
connections, etc, etc).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14975] import unicodedata, DLL load failed on Python 2.7.3

2012-05-31 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I do not believe that this is a problem in Python. Instead, it appears that 
your Python installation got corrupted somehow.

I recommend to run a virus scanner.

--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread Richard Oudkerk

Richard Oudkerk  added the comment:

> a) fork() is called with the DB lock held by thread1.
> b) Some time passes before the child gets to exec().
> c) In that time, the child's thread2 gets to doWork(). 
> d) Simultaneously, the parent's doWork is still running and holding a lock.
> e) Thanks to reinit_locks, the child's thread2 does not have a lock, and 
> it will merrily proceed to corrupt the parent's work.

You seem to be saying that all three threads survive the fork.

I think forkall() on Solaris acts like that, but the normal fork() function 
does not.  Only the thread which performs fork() will survive in the child 
process.

So doWork() never runs in the child process, and the lock is never used in the 
child process.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14959] ttk.Scrollbar in Notebook widget freezes

2012-05-31 Thread Ned Deily

Ned Deily  added the comment:

Another data point: I just tried the same test using a Python 3.2.3 linked with 
an X11 Tk 8.5 (MacPorts) rather than the ActiveState Cocoa Tk 8.5.11 
(python.org Python).  I was not able to get the test to fail with X11 Tk so 
that tends to support the idea that the root cause is somewhere in Aqua Tk.

--
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14971] (unittest) loadTestsFromName does not work on method with a decorator

2012-05-31 Thread Michael Foord

Michael Foord  added the comment:

Whilst functools.wraps would fix the problem it still sounds like a bug (or at 
the very least a reasonable feature request).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14972] listcomp with nested classes

2012-05-31 Thread Hynek Schlawack

Changes by Hynek Schlawack :


--
nosy: +hynek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread lesha

lesha  added the comment:

I am really alarmed by the reinit_locks patches.

I scanned the comment history, and looked at the patch. I may have missed 
something, but it looks to me like the basic behavior is this:

"After fork(), all locks are replaced by brand-new lock objects that are NOT 
locked."

*Grim Prediction*: This is going to cause some disastrous, unexpected, and 
hilarious data loss or corruption for somebody.

Here is why:

  class MySQLConn:

def __init__(self):
  self.lock = Lock()

def doWork(self):
  self.lock.acquire()
  # do a sequence of DB operations that must not be interrupted,
  # and cannot be made transactional.
  self.lock.release()

Run this in a thread:

  def thread1(conn):
while True:
  conn.doWork()
  time.sleep(0.053)

Run this in another thread:

  def thread2(conn):
while True:
  conn.doWork()
  time.sleep(0.071)

Run this in a third thread:

  def thread2():
while True:
  subprocess.call(["ls", "-l"])
  time.sleep(0.3)

With reinit_locks(), this will eventually break horribly. 

a) fork() is called with the DB lock held by thread1.
b) Some time passes before the child gets to exec().
c) In that time, the child's thread2 gets to doWork(). 
d) Simultaneously, the parent's doWork is still running and holding a lock.
e) Thanks to reinit_locks, the child's thread2 does not have a lock, and it 
will merrily proceed to corrupt the parent's work.

So I think this approach is basically doomed.

I think my approach of marking _some_ locks as safe to reinit upon fork is 
workable (i.e. to solve the bad interaction with logging or import). 

However, there's also an orthogonal approach that might work well:

1) Right before the first thread gets created in any Python program, fork off a 
fork() server. 

>From then on, subprocess will only use the fork server to call commands.

Thoughts?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14975] import unicodedata, DLL load failed on Python 2.7.3

2012-05-31 Thread YF

New submission from YF :

Before I use the Python 2.7.2 on Windows XP, today I tried to upgrade to the 
Python 2.7.3, but encountered a problem.
When running any .py file encountered "import unicodedata" or directly run the 
command always returns:
Traceback (most recent call last):
..
import unicodedata
ImportError: DLL load failed: 找不到指定的程序。
"找不到指定的程序" corresponding English is "Cannot find the specified program".

I unable provide more information because I am only a user rather than 
developer.

After that, I manually delete "C:\Python27\DLLs\unicodedata.pyd" file (this 
step must be, otherwise no effect), then reinstall (Repair) Python 2.7.2 the 
problem disappeared.

--
components: Unicode
messages: 162030
nosy: ezio.melotti, yfdyh000
priority: normal
severity: normal
status: open
title: import unicodedata, DLL load failed on Python 2.7.3
type: compile error
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14974] rename packaging.pypi to packaging.index

2012-05-31 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

While I can see your point, I think that "index" is way too generic. I also 
think that the pypi term is overloaded with both meanings.

--
nosy: +hynek

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-05-31 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset bd2c2def77a7 by Hynek Schlawack in branch 'default':
#14814: Remove stale __hex__ method from ipaddress
http://hg.python.org/cpython/rev/bd2c2def77a7

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14974] rename packaging.pypi to packaging.index

2012-05-31 Thread Alexis Metaireau

New submission from Alexis Metaireau :

PyPI is the name of a particular index, whereas "index" is a generic term.

So ISTM that it would be better to use the latter, semantically-wise.

--
assignee: alexis
components: Distutils2
messages: 162027
nosy: alexis, tarek
priority: normal
severity: normal
stage: needs patch
status: open
title: rename packaging.pypi to packaging.index
type: enhancement
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14972] listcomp with nested classes

2012-05-31 Thread R. David Murray

R. David Murray  added the comment:

This is doubtless a result of the way the class namespace scope is handled, 
coupled with the fact that in Python3 list comprehensions have a local scope.  
The class scope is a somewhat unique beast.  I agree that this is unfortunate, 
but I have a feeling that doing anything about it is distinctly non-trivial.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14973] restore python2 unicode literals in "ru" strings

2012-05-31 Thread rurpy the second

New submission from rurpy the second :

PEP 414 proposes restoring the "u" string prefix (semantically as a "noop") to 
make porting from Python2 easier.  I would like to propose that "ru"-strings 
also interpret embedded "\u" unicode literals in the python2 fashion (as a 
single unicode character) rather than in the python 3.2 fashion (as 6 
characters).

Many Python2 programs use unicode literals in strings because they can be 
represented and displayed in source code with the ascii character set.  For 
example, I often write ur" \u3000\u3042\t" rather than ur"  あ" because the 
former is much clearer in source code than the latter and does not require the 
viewer to have a Japanese font installed.

However such a string must be manually converted for Python3 because the former 
string has a very different meaning in Python3 than Python2.  The equivalent in 
Python3 is " \u3000\u3042\\t".  AFAIK, 2to3 does not fix this.  Because there 
are no longer unicode literals in Python3 raw strings, any string with a 
unicode literal *has* to be a non-raw string (AFAICT).  This means that strings 
used as regexes, that have a lot of backslashes and have unicode literals, must 
have the backslashes doubled.  Doubling the backslashes in the above example is 
trivial but it is not trival in more realistic regexes.  This was one of the 
main reasons for having raw strings in Python2 I thought.  It is unfortunate 
that one looses this ability (in the presence of unicode literals) in Python3.

When I raised this issue on the Python user's list [*1], Terry Reedy made the 
suggestion that since the "u" string prefix was being reintroduced for python 
3.3, that having the prefix also restore the python2 unicode literal handling 
would not introduce any incompatibilties and would greatly increase the ease of 
porting to Python3 for some programs.[*2]  He subsequently raised the issue on 
the dev list.[*3]

An argument might be made that this is an extra feature that would encourage 
the use of the "u"-prefix beyond that of easing porting from Python2.  Perhaps 
so but there is currently a hole in Python's capability that is difficult to 
work around, and I've seen no other proposals to fix it.  So it seems to me 
that the benefits of this proposal greatly outweigh that somewhat purist 
argument.

[*1] http://mail.python.org/pipermail/python-list/2012-May/1292870.html
[*2] http://mail.python.org/pipermail/python-list/2012-May/1292887.html
[*3] http://mail.python.org/pipermail/python-dev/2012-May/119760.html

--
components: Unicode
messages: 162025
nosy: ezio.melotti, rurpy2
priority: normal
severity: normal
status: open
title: restore python2 unicode literals in "ru" strings
type: enhancement
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14972] listcomp with nested classes

2012-05-31 Thread Westley Martínez

Westley Martínez  added the comment:

$ python
Python 3.2.3 (default, Apr 23 2012, 23:35:30) 
[GCC 4.7.0 20120414 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class A:
... x = 42
... y = [x for _ in '1']
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 3, in A
  File "", line 3, in 
NameError: global name 'x' is not defined
>>> x = 42
>>> class A:
... x = 12
... y = [x for _ in '1']
... 
>>> A.y
[42]

It seems that the list comprehension is looking at the module's scope as 
opposed to the class scope.  This definitely seems incorrect to me.

--
nosy: +anikom15

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14972] listcomp with nested classes

2012-05-31 Thread Alex Gaynor

Changes by Alex Gaynor :


--
nosy: +alex

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14972] listcomp with nested classes

2012-05-31 Thread Florent Xicluna

Florent Xicluna  added the comment:

Simpler test case:

class A:
   x = 42
   y = [x for _ in '1']


The semantics of list comprehension changed with Python 3.
However, I do not see this specific behavior documented somewhere.

http://docs.python.org/dev/whatsnew/3.0.html#changed-syntax

--
components: +Interpreter Core
nosy: +flox
versions: +Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14972] listcomp with nested classes

2012-05-31 Thread josmiley

New submission from josmiley :

# this runs with python2.7, not with python3.2
class Foo(object):

class Bar(object):
pass

Attr = [Bar()for n in range(10)]

# solved in this way ...
class Foo(object):

class Bar(object):
pass

Attr = []
for n in range(10): Attr.append(Bar())

--
messages: 162022
nosy: josmiley
priority: normal
severity: normal
status: open
title: listcomp with nested classes
type: behavior
versions: Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14969] Restore sys.exc_clear()?

2012-05-31 Thread alon horev

alon horev  added the comment:

Another possible solution is to explicitly set an exception's 
__supress_context__ attribute to False (right now impossible because it's the 
default value). 
If a user can 'turn on' the flag when attaching a different exception (raise X 
from Y), why not allow 'turning it off'? (symmetry anyone?) right now it is set 
to False by default and changed to true when 'raising from'.
I suggest changing the default to None, allowing the user to explicitly say: 
I'm no longer in the previous exception's context.

Feels a bit like solving our hack with another hack (:

And about the PSF contrib agreement, I'll do it as soon as I'm near a printer. 
too bad we're using pens and not RSA private keys for signatures (-:

   thanks, Alon

--
nosy: +alonho

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14635] telnetlib uses select instead of poll - limited to FD_SETSIZE fds

2012-05-31 Thread Akintayo Holder

Akintayo Holder  added the comment:

Hi,

telnet.read_until() and telnet.expect() will use select.poll() instead of 
select.select() on systems where poll() is available.

The patch also includes updates to test_telnetlib, the read_until() tests were 
changed to test the case where poll() is unavailable. We also added unit tests 
for expect(), these are a copy of the read_until() tests.

This patch is against 2.7.

Akintayo

--
nosy: +akintayo
Added file: http://bugs.python.org/file25777/telnet_expect_read_until_using_poll

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6721] Locks in python standard library should be sanitized on fork

2012-05-31 Thread Richard Oudkerk

Richard Oudkerk  added the comment:

Attached is an updated version of Charles-François's reinit_locks.diff.

Changes:

* Handles RLock by assuming that if self->count != 0 when we acquire
  the lock, then the lock must have been reinitialized by 
PyThread_ReInitLocks().

* Applies existing fork tests for Lock to RLock.

* Fixes capitalization issues with 
PyThread_ReInitLocks()/PyThread_ReinitLocks().

* Defines PyThread_ReInitLocks() to be empty on non-pthread platforms.

Note that RLock._is_owned() is unreliable after a fork until RLock.acquire() 
has been called.

Also, no synchronization has been added for the list of locks.  Are 
PyThread_allocate_lock() and PyThread_free_lock() supposed to be safe to call 
while not holding the GIL?

--
Added file: http://bugs.python.org/file25776/reinit_locks_2.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14814] Implement PEP 3144 (the ipaddress module)

2012-05-31 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

It's funny how raising the test coverage _always_ uncovers lurking bugs in 
obscure branches. :) Patch attached, let me know if I got it wrong – would 
commit otherwise.

A few quick side-note: does the __version__ variable make sense in stdlib?

--
Added file: http://bugs.python.org/file25775/fix-type-error.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14971] (unittest) loadTestsFromName does not work on method with a decorator

2012-05-31 Thread R. David Murray

R. David Murray  added the comment:

I don't think this is documented anywhere (and should be).  I believe what you 
need to do is use functools.wraps on your wrapper function.

--
assignee:  -> docs@python
components: +Documentation -None
nosy: +docs@python, michael.foord, r.david.murray
versions: +Python 3.2, Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14938] 'import my_pkg.__init__' creates duplicate modules

2012-05-31 Thread Ronan Lamy

Ronan Lamy  added the comment:

That would force the Loaders to know how to convert a module name into a file 
path, which isn't the case now since FileLoader.get_filename() is just a shim 
that returns self.path. So I'd rather add an optional argument to FileLoader. 
Actually, I feel that the clean solution would be to have packages be a 
separate Loader class, but that would be a significant change...

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14971] (unittest) loadTestsFromName does not work on method with a decorator

2012-05-31 Thread Alessandro Piccione

New submission from Alessandro Piccione :

Steps to reproduce the problem.
1. Create a module (ex. name it "test") 
2. Create a file in it (ex. mainTest.py) with a class (ex. MainTest) derived 
from TestCase.
3. Create a test method in that class, (ex. test_base), prefix it with "test".
4. Create a decorator (ex. clear_args) and use it on the test method 
5. Create a test suite with the function "loadTestsFromName" of TestLoader 
class and make a TestRunner run it (I use a TextTestRunner). 
suite = 
unittest.TestLoader().loadTestsFromName('test.mainTest.MainTest.test_base')
unittest.TextTestRunner(verbosity=2).run(suite)


It is expected that the test is run (it runs without decorator).
It gives an error: no such test method in : 
wrapper.
"wrapper" is the name of the returned function in the decorator.


I'm using Python 2.7.3 on Windows 7 64bit.
I search "loadTestsFromName decorator" without results, so I decided to report 
as new issue. This is my first report, I admit I've not read any 
guide/instructions.

--
components: None
messages: 162015
nosy: alex.75
priority: normal
severity: normal
status: open
title: (unittest) loadTestsFromName does not work on method with a decorator
type: behavior
versions: Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14962] When changing IDLE configuration all text in shell window loses highlighting

2012-05-31 Thread Ned Deily

Ned Deily  added the comment:

LGTM, thanks.  Applied for release in 2.7.4, 3.2.4, and 3.3.0.

--
nosy: +ned.deily
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
versions: +Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14962] When changing IDLE configuration all text in shell window loses highlighting

2012-05-31 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 1a4e99460438 by Ned Deily in branch '2.7':
Issue #14962: Update text coloring in IDLE shell window after changing
http://hg.python.org/cpython/rev/1a4e99460438

New changeset 9d0c3a835bfe by Ned Deily in branch '3.2':
Issue #14962: Update text coloring in IDLE shell window after changing
http://hg.python.org/cpython/rev/9d0c3a835bfe

New changeset 86f62adb09cf by Ned Deily in branch 'default':
Issue #14962: merge
http://hg.python.org/cpython/rev/86f62adb09cf

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14970] -v command line option is broken

2012-05-31 Thread Brett Cannon

Brett Cannon  added the comment:

Not a problem. =)

If you want to know where an import originated from, you can probably do 
something as simple as overload builtins.__import__ with a version that does a 
quick stack look to see where the previous call is coming from.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14962] When changing IDLE configuration all text in shell window loses highlighting

2012-05-31 Thread Roger Serwy

Roger Serwy  added the comment:

Attached is a patch to fix this issue. 

The ModifiedColorDelegator already marks everything before "iomark" as SYNC'ed. 
This is good, as the ColorDelegator should not be trying to colorize STDOUT 
text as Python code. 

Resetting the ColorDelegator in _rmcolorizer in EditorWindow.py calls 
.removecolors(). The patch modifies this method to only remove tags *after* the 
iomark.

--
keywords: +patch
Added file: http://bugs.python.org/file25774/issue14962.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14970] -v command line option is broken

2012-05-31 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Oh dear, silly me.
I misunderstood the point of -v _and_ misunderstood the output of 2.7 I was 
quoting.
I was looking for a way to find out where the import originated from, not which 
file would be imported as a result.

Import errors, along with pickling errors, are some of the most annoying ones 
to debug, because they tend to require so much detective work.

Ok, I'll close this then.  Sorry about the noise.

--
resolution:  -> invalid
status: pending -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14970] -v command line option is broken

2012-05-31 Thread Brett Cannon

Brett Cannon  added the comment:

I am setting this as pending since I consider the total output acceptable, but 
if Kristján has specific issues he wants to bring up or change he still can.

--
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14970] -v command line option is broken

2012-05-31 Thread Brett Cannon

Brett Cannon  added the comment:

The information is still there, just in a different output line (i.e. 
http://hg.python.org/cpython/file/c7b16e2be71a/Lib/importlib/_bootstrap.py#l735 
outputs the same info, just on its own line). I couldn't keep the old format as 
the code has been shifted around enough compared to how import.c was structured 
that reproducing the same output would have required a code refactor and 
contortion that wasn't worth it. I did my best to make sure no useful data was 
left out (and actually there is more since the loader is now also stated so you 
always have that info instead of only what Python's included loaders provide).

--
nosy: +brett.cannon

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14938] 'import my_pkg.__init__' creates duplicate modules

2012-05-31 Thread Brett Cannon

Brett Cannon  added the comment:

I see what you mean about the discrepancy, but you don't need to complicate the 
constructor to get the desired result. If you have is_package() check if the 
module name ends in __init__ to skip the package check and just say False (e.g. 
only if the path ends in __init__ but the module name does not) then you will 
get your desired semantics out of is_package (since this is what find_loader() 
is doing).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14970] -v command line option is broken

2012-05-31 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Yes, I found that.  The line in question is, however, this:
 _verbose_message('import {!r} # {!r}', name, loader)
(_bootstrap.py:1254).

Unfortunately, I see no way to get at the line from which the import occurred 
here.  The loader itself is not useful for that.  Perhaps the author of 
importlib knows more, e.g. whether the feature to know whence an import 
originates is useful or has been dropped.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14952] Cannot run regrtest with amd64/debug on windows

2012-05-31 Thread Kristján Valur Jónsson

Changes by Kristján Valur Jónsson :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14952] Cannot run regrtest with amd64/debug on windows

2012-05-31 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c7b16e2be71a by Kristjan Valur Jonsson in branch 'default':
Issue #14952: Fix incorrect output dll names for win64/debug builds, causing
http://hg.python.org/cpython/rev/c7b16e2be71a

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14952] Cannot run regrtest with amd64/debug on windows

2012-05-31 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

I've found what is wrong.
There is a problem with _multiprocessing.pyd on 64 bit debug builds.
Why this manifests itself as it does, I don´t know.  Someone must be silencinng 
the proper import error.

this is most likely a build config error, that I will fix.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14970] -v command line option is broken

2012-05-31 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

See http://hg.python.org/cpython/file/default/Lib/importlib/_bootstrap.py
for the source of SourceFileLoader.

--
nosy: +loewis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14970] -v command line option is broken

2012-05-31 Thread Kristján Valur Jónsson

New submission from Kristján Valur Jónsson :

Using the -v command line option to diagnose import problem is no longer 
useful.  In stead of lines like this in version 2.7:

import UserDict # from 
D:\p4\games\branches\development\MAIN\eve\dust\tool\bin/../../../../carbon/src/stackless/Lib/UserDict.py

we now get:
import 'textwrap' # <_frozen_importlib.SourceFileLoader object at 
0x02E14438>

I don't even know what a _frozen_importlib.SourceFileLoader is.

--
components: Interpreter Core
messages: 162002
nosy: kristjan.jonsson
priority: normal
severity: normal
status: open
title: -v command line option is broken
type: behavior
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14963] Use an iterative implementation for contextlib.ExitStack.__exit__

2012-05-31 Thread Nick Coghlan

Nick Coghlan  added the comment:

Interesting - it turns out we can't fully reproduce the behaviour of nested 
with statements in ExitStack (see the new reference test I checked in, as well 
as #14969)

I added one technically redundant variable to the implementation to make it 
more obviously correct to the reader, as well as a test that ensures the stack 
can handle ridiculous numbers of callbacks without failing (a key advantage of 
using a single frame rather than one frame per callback)

While it isn't mandatory, we prefer it if contributors submit Contributor 
Agreements even for small changes. If you're happy to do that, I consider 
emailing a scanned or digitally photographed copy of the signed form as 
described here to be the simplest currently available approach: 
http://www.python.org/psf/contrib/

--
resolution: fixed -> 
stage: committed/rejected -> test needed
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14963] Use an iterative implementation for contextlib.ExitStack.__exit__

2012-05-31 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c0c7618762e5 by Nick Coghlan in branch 'default':
Close #14963: Use an iterative algorithm in contextlib.ExitStack.__exit__ 
(Patch by Alon Horev)
http://hg.python.org/cpython/rev/c0c7618762e5

--
resolution:  -> fixed
stage: test needed -> committed/rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14963] Use an iterative implementation for contextlib.ExitStack.__exit__

2012-05-31 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset fc73e6ea9e73 by Nick Coghlan in branch 'default':
Issue #14963: Added test cases for contextlib.ExitStack exception handling 
behaviour (Initial patch by Alon Horev)
http://hg.python.org/cpython/rev/fc73e6ea9e73

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14969] Restore sys.exc_clear()?

2012-05-31 Thread Nick Coghlan

New submission from Nick Coghlan :

When adding the test case for #14963, I discovered that contextlib.ExitStack 
can't *quite* reproduce the exception handling of nested with statements.

The problem arises when the original exception gets suppressed by one of the 
handlers, but an outer handler raises a *new* exception, then nested with 
statements will correctly indicate that there was no exception context active 
when the new exception was raised (since the inner with statement will fully 
clear the exception state).

By contrast, when using ExitStack, the interpreter will add the original 
exception from inside the body of the with statement as the context for the 
*new* exception, even though the inner exception had been suppressed before the 
outer one was encountered.

Restoring sys.exc_clear() *might* allow this discrepancy to be resolved by 
explicitly clearing the exception state when one of the callbacks indicates 
that the current exception has been handled (although it might be trickier than 
that, if the problem is actually due to caching the exception state inside the 
with cleanup code in the eval loop)

--
components: Interpreter Core, Library (Lib)
messages: 161998
nosy: ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Restore sys.exc_clear()?
type: enhancement
versions: Python 3.3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14964] distutils2.utils.resolve_name cleanup

2012-05-31 Thread Ronny Pfannschmidt

Ronny Pfannschmidt  added the comment:

i missused hg export, here is a corrected patch

--
Added file: http://bugs.python.org/file25773/resolve_name.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14968] Section "Inplace Operators" of :mod:`operator` should be a subsection

2012-05-31 Thread Lars Buitinck

New submission from Lars Buitinck :

The section "Inplace Operators" of the module docs for operator now show up in 
TOC at http://docs.python.org/dev/library/. I don't think that's intended as it 
does not describe a separate module.

--
assignee: docs@python
components: Documentation
files: operator-module-docs.patch
keywords: patch
messages: 161996
nosy: docs@python, larsmans
priority: normal
severity: normal
status: open
title: Section "Inplace Operators" of :mod:`operator` should be a subsection
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25772/operator-module-docs.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14964] distutils2.utils.resolve_name cleanup

2012-05-31 Thread Ronny Pfannschmidt

Ronny Pfannschmidt  added the comment:

updated the patch with more detailed errors

--
Added file: http://bugs.python.org/file25771/resolve_name.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14967] distutils2.utils.resolve_name cannot be implemented to give correct errors in all situations

2012-05-31 Thread Ronny Pfannschmidt

Ronny Pfannschmidt  added the comment:

an example of creating a wrong error would be something like the following:

there is a package foo.bar, which does a wrong import in __init__.py
we want to resolve the name foo.bar.something

we'd get the error that foo has no attribute bar

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14967] distutils2.utils.resolve_name cannot be implemented to give correct errors in all situations

2012-05-31 Thread Ronny Pfannschmidt

Ronny Pfannschmidt  added the comment:

to correctly implement it we need the : separator back

with the separator the import specification is no longer ambigious,
and we can use one exact import, and an error will always be an error

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14967] distutils2.utils.resolve_name cannot be implemented to give correct errors in all situations

2012-05-31 Thread Tarek Ziadé

Changes by Tarek Ziadé :


--
resolution:  -> duplicate
superseder:  -> Improve error reporting for packaging.util.resolve_name

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14967] distutils2.utils.resolve_name cannot be implemented to give correct errors in all situations

2012-05-31 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

can you give an example of a bad error ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14967] distutils2.utils.resolve_name cannot be implemented to give correct errors in all situations

2012-05-31 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

the current code works as expected. Why not leaving it like this since your 
change seem to be comsetics only ?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14967] distutils2.utils.resolve_name cannot be implemented to give correct errors in all situations

2012-05-31 Thread Ronny Pfannschmidt

New submission from Ronny Pfannschmidt :

due to the lack of a marker that denotes where the module ends and the 
attribute starts, unrelated import errors can break the try&error chain at 
unexpected places and the code can pass on to the recursive getattr chain, 
giving a completely different error instead of the real error

this is not solvable without a marker or really nasty hacks o track subsequent 
imports

--
assignee: eric.araujo
components: Distutils2
messages: 161990
nosy: Ronny.Pfannschmidt, alexis, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: distutils2.utils.resolve_name cannot be implemented to give correct 
errors in all situations

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14964] distutils2.utils.resolve_name cleanup

2012-05-31 Thread Ronny Pfannschmidt

Ronny Pfannschmidt  added the comment:

my change is a unrelated cleanup
but the ideas in the patch look good

the attribute error addition seems relevant

i'll adapt my patch to raise the original import error for toplevel import 
failure and accumuplate the attrbute name so it can raise the correct error

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14909] Fix incorrect use of *Realloc() and *Resize()

2012-05-31 Thread Kristján Valur Jónsson

Changes by Kristján Valur Jónsson :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14909] Fix incorrect use of *Realloc() and *Resize()

2012-05-31 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 588ea940e5e3 by Kristjan Valur Jonsson in branch 'default':
Issue #14909: A number of places were using PyMem_Realloc() apis and
http://hg.python.org/cpython/rev/588ea940e5e3

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14007] xml.etree.ElementTree - XMLParser and TreeBuilder's doctype() method missing

2012-05-31 Thread Eli Bendersky

Eli Bendersky  added the comment:

* Another problem: the C implementation of XMLParser does not take 3 positional 
args, but only 2. Although the 'html' arg is documented as "unsupported", it 
should still be taken and silently ignored, similarly to the Python version

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14899] Naming conventions and guidelines for packages and namespace packages

2012-05-31 Thread Alexis Metaireau

Changes by Alexis Metaireau :


--
nosy: +alexis

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14963] Use an iterative implementation for contextlib.ExitStack.__exit__

2012-05-31 Thread alon horev

alon horev  added the comment:

that was indeed trickier, but overriding the __context__ attribute did the 
trick.

--
Added file: http://bugs.python.org/file25770/14963.2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14945] Setup & Usage documentation for selected stdlib modules

2012-05-31 Thread A.M. Kuchling

Changes by A.M. Kuchling :


--
nosy: +akuchling

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14944] Setup & Usage documentation for pydoc, idle & 2to3

2012-05-31 Thread A.M. Kuchling

Changes by A.M. Kuchling :


--
nosy: +akuchling

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10376] ZipFile unzip is unbuffered

2012-05-31 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The patch updated to reflect Martin's stylistic comments.

Sorry for the delay, Martin. I have not received an email with your review from 
2012-05-13, and only today accidentally discovered your comments in Rietveld. 
It seems to have been some bug in Rietveld.

--
Added file: http://bugs.python.org/file25769/zipfile_optimize_read_2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com