[issue17267] datetime.time support for '+' and 'now'

2013-02-26 Thread Ronald Oussoren

Changes by Ronald Oussoren :


--
keywords: +needs review
nosy: +belopolsky

___
Python tracker 

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



[issue17251] LWPCookieJar load() set domain_specifed wrong

2013-02-26 Thread Demian Brecht

Demian Brecht added the comment:

That was silly of me. What I /meant/ to say was that, for this specific report, 
it's functioning as expected. However, the logic in LWPCookieJar isn't entirely 
correct. As noted in the comments from libwww-perl, the reported URL is in 
fact, an invalid LWP cookie. What's missing is the logic to deal with other, 
valid cookies. 

domain_specified = domain.starts_with('.') is incorrect as a four part domain 
name (a.b.c.d) /is/ a valid LWP domain.

This should likely be patched.

Another question that I have though, is why is LWPCookieJar even part of the 
stdlib? It's relatively well documented that it is not known to be compatible 
with any browser. I'm curious as to how heavily used it is and what the 
rational was to include it (dev might be a better place to ask this, I'm not 
sure).

--

___
Python tracker 

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



[issue17269] getaddrinfo segfaults on OS X when provided with invalid arguments combinations

2013-02-26 Thread Ronald Oussoren

Ronald Oussoren added the comment:

My bug submission at Apple was closed as a duplicate of radar 13058317.

Given the state of testing of getaddrinfo a testcase will be easier than 
expected, just pasting the call in this bugreport into the right testcase will 
match the style of most other checks in that testcase.

--

___
Python tracker 

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



[issue12915] Add inspect.locate and inspect.resolve

2013-02-26 Thread Vinay Sajip

Vinay Sajip added the comment:

> Can you provide a couple of examples of that notation?

entry_points = """
[console_scripts]
pybabel = babel.messages.frontend:main

[distutils.commands]
compile_catalog = babel.messages.frontend:compile_catalog
extract_messages = babel.messages.frontend:extract_messages
init_catalog = babel.messages.frontend:init_catalog
update_catalog = babel.messages.frontend:update_catalog

[distutils.setup_keywords]
message_extractors = babel.messages.frontend:check_message_extractors

[babel.checkers]
num_plurals = babel.messages.checkers:num_plurals
python_format = babel.messages.checkers:python_format

[babel.extractors]
ignore = babel.messages.extract:extract_nothing
python = babel.messages.extract:extract_python
javascript = babel.messages.extract:extract_javascript
"""

Source:

http://babel.edgewall.org/browser/trunk/setup.py#L38

--

___
Python tracker 

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



[issue17267] datetime.time support for '+' and 'now'

2013-02-26 Thread Petri Lehtinen

Petri Lehtinen added the comment:

LGTM.

--
stage: test needed -> patch review

___
Python tracker 

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



[issue15465] Improved documentation for C API version info

2013-02-26 Thread Kushal Das

Kushal Das added the comment:

Attaching patch with the initial documentation of the macros. It also fixes the 
typo in the title of stable API section.

--
keywords: +patch
nosy: +kushaldas
Added file: http://bugs.python.org/file29258/issue15465.patch

___
Python tracker 

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



[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2013-02-26 Thread Ezio Melotti

Ezio Melotti added the comment:

> I'm just not sure how the globals help 

It doesn't, but if it works fine there's probably no reason to complicate (if 
it's complicated at all) things to change this.

> even when I just want to run the pure Python code, the C module gets
> imported. Why should it be?

Doesn't the test always run both? (assuming the C module is available -- if 
it's not it won't be imported anyway)

> Pickle is one concrete place that can cause problems with this.

This might be an actual reason to avoid globals, but I don't know the details.

--

___
Python tracker 

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



[issue17278] SIGSEGV in _heapqmodule.c

2013-02-26 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
priority: normal -> high

___
Python tracker 

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



[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2013-02-26 Thread Eli Bendersky

Eli Bendersky added the comment:

On Tue, Feb 26, 2013 at 8:08 PM, Ezio Melotti wrote:

>
> Ezio Melotti added the comment:
>
> > The next logical step is to make all test classes in test_xml_etree
> > accept the ET module in some way and store it, using it to get classes
> > & function. I.e. no more global "ET" and "pyET" at all.
>
> The idiom suggested by PEP 399 has the two modules (cmod and pymod) as
> globals, and then simply sets them as class attributes.  Is there any
> reason why this should be avoided in this case?
>

I'm just not sure how the globals help except for saving 2-3 lines of code.
I do see how they can cause problems because even when I just want to run
the pure Python code, the C module gets imported. Why should it be? I
really don't want it to, I want to isolate things as much as possible
(after all, testing the pure Python module actually tests a scenario where
there is no C module). Pickle is one concrete place that can cause problems
with this.

We talked about related things in Issue #15083 and AFAIR Eric's and Brett's
proposals move these modules away from the global namespace.

--

___
Python tracker 

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



[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2013-02-26 Thread Ezio Melotti

Ezio Melotti added the comment:

> The next logical step is to make all test classes in test_xml_etree 
> accept the ET module in some way and store it, using it to get classes 
> & function. I.e. no more global "ET" and "pyET" at all.

The idiom suggested by PEP 399 has the two modules (cmod and pymod) as globals, 
and then simply sets them as class attributes.  Is there any reason why this 
should be avoided in this case?

--

___
Python tracker 

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



[issue12915] Add inspect.locate and inspect.resolve

2013-02-26 Thread Ezio Melotti

Ezio Melotti added the comment:

Can you provide a couple of examples of that notation?

--

___
Python tracker 

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



[issue10799] Improve webbrowser (.open) doc and behavior

2013-02-26 Thread Ezio Melotti

Ezio Melotti added the comment:

On WinXP, if I try "firefox bugs.python.org", I get an error because it can not 
find firefox in the PATH.  This is probably what happens with 
_isexecutable("firefox").
However if I try "C:\Program Files\Mozilla Firefox\>firefox.exe 
bugs.python.org", Firefox correctly opens the page.

So I think that the problem here is not that the browser fails to open 
"bugs.python.org" or "google.com", but that the executable of the browser is 
not found, and whatever is used to open "bugs.python.org" (os.startfile()?) 
doesn't know that it should be opened with Firefox.

> In the longer run, what I would really like is for webbrowser to be
> better at using the default or finding executables.

I haven't looked at the code, but, if reasonable, it should search in some 
common folders for the executables of the supported browsers.

Should I create a separate issue for this?  If this solution is not viable, we 
can always document that the URLs have to start with 'http://' or 'www.'.

--

___
Python tracker 

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



[issue17306] Improve the way abstract base classes are shown in help()

2013-02-26 Thread Raymond Hettinger

New submission from Raymond Hettinger:

Start by adding docstrings to the colletions ABCs.
Look at improving help() to clearly show the required abstract methods.

--
assignee: rhettinger
components: Documentation
messages: 183107
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Improve the way abstract base classes are shown in help()
type: enhancement
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



[issue17305] IDNA2008 encoding missing

2013-02-26 Thread R. David Murray

R. David Murray added the comment:

How are they handling interoperability?

--
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



[issue12144] cookielib.CookieJar.make_cookies fails for cookies with 'expires' set

2013-02-26 Thread Demian Brecht

Demian Brecht added the comment:

I was able to repro this with Terry's steps on latest hg update. I've taken 
Scott's patch and updated it to diff from source root (his was pointing to 
/usr/lib) against the latest. The patch fixes the issue and I also can't see 
any negative knock-ons that may be caused by applying it.

--
Added file: http://bugs.python.org/file29257/cookiejar_12144.patch

___
Python tracker 

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



[issue12144] cookielib.CookieJar.make_cookies fails for cookies with 'expires' set

2013-02-26 Thread Demian Brecht

Changes by Demian Brecht :


--
nosy: +dbrecht

___
Python tracker 

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



[issue17305] IDNA2008 encoding missing

2013-02-26 Thread Marten Lehmann

New submission from Marten Lehmann:

Since Python 2.3 the idna encoding is available for Internationalized Domain 
Names. But the current encoding doesn't work according to the latest version of 
the spec.

There is a new IDNA2008 specification (RFCs 5890-5894). Although I'm not very 
deep into all the changes, I know that at least the nameprep has changed. For 
example, the German sharp S ('ß') isn't replaced by 'ss' any longer.

The attached file shows the difference between the expected translation and the 
actual translation.

--
components: Library (Lib)
files: idna_translate.py
messages: 183104
nosy: marten
priority: normal
severity: normal
status: open
title: IDNA2008 encoding missing
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5
Added file: http://bugs.python.org/file29256/idna_translate.py

___
Python tracker 

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



[issue16942] urllib still doesn't support persistent connections

2013-02-26 Thread Demian Brecht

Demian Brecht added the comment:

http://bugs.python.org/issue1690 seems to be a duplicate of this one (at least 
the initial report). 16901 (imho) is documented more clearly than this one, so 
can this one be closed as duplicate?

--

___
Python tracker 

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



[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-02-26 Thread karl

karl added the comment:

ok I modify the code of server.py so that the server doesn't send the private 
message but the one which is already assigned by the library as it should. If 
there is a need for customization, there should be two separate variables, but 
which could lead to the same issues.

After modifications this is what I get.

→ telnet localhost 9000
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Host: localhost:9000

HTTP/1.0 500 Internal Server Error
Server: BaseHTTP/0.6 Python/3.3.0
Date: Wed, 27 Feb 2013 00:21:21 GMT
Content-Type: text/html;charset=utf-8
Connection: close

http://www.w3.org/TR/html4/strict.dtd";>



Error response


Error response
Error code: 500
Message: Traceback (most recent call last):
  File "server.py", line 11, in do_GET
assert(False)
AssertionError
.
Error code explanation: 500 - Server got itself in trouble.


Connection closed by foreign host.


I joined the patch: server.issue12921.patch

--
keywords: +patch
Added file: http://bugs.python.org/file29255/server.issue12921.patch

___
Python tracker 

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



[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-02-26 Thread karl

karl added the comment:

OK I had understand a bit better. 

self.send_error(code, msg) is used for

* The body
* The HTTP header
* and the log

That's bad, very bad.

I do not think it should be used for the HTTP Header at all.

--

___
Python tracker 

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



[issue12921] http.server.BaseHTTPRequestHandler.send_error and trailing newline

2013-02-26 Thread karl

karl added the comment:

Testing your code in Listing 1

→ curl -sI http://localhost:9000/
HTTP/1.0 501 Unsupported method ('HEAD')
Server: BaseHTTP/0.6 Python/3.3.0
Date: Tue, 26 Feb 2013 23:38:32 GMT
Content-Type: text/html;charset=utf-8
Connection: close

So this is normal, 
http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22#section-6.6.2

except that it would be better to use "501 Not Implemented" through the prose 
is optional. The content-type is also kind of useless. That would deserve to 
open another bug.


And

→ curl http://localhost:9000/
Server: BaseHTTP/0.6 Python/3.3.0
Date: Tue, 26 Feb 2013 23:39:46 GMT
Content-Type: text/html;charset=utf-8
Connection: close

http://www.w3.org/TR/html4/strict.dtd";>



Error response


Error response
Error code: 500
Message: Traceback (most recent call last):
  File "server.py", line 9, in do_GET
assert(False)
AssertionError
.
Error code explanation: 500 - Server got itself in trouble.



OK. The server is answering with HTTP/1.0 and then a Traceback… which has 
nothing to do here.


We can see that in more details with a telnet

→ telnet localhost 9000
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Host: localhost:9000

HTTP/1.0 500 Traceback (most recent call last):
  File "server.py", line 9, in do_GET
assert(False)
AssertionError

Server: BaseHTTP/0.6 Python/3.3.0
Date: Tue, 26 Feb 2013 23:49:04 GMT
Content-Type: text/html;charset=utf-8
Connection: close

http://www.w3.org/TR/html4/strict.dtd";>



Error response


Error response
Error code: 500
Message: Traceback (most recent call last):
  File "server.py", line 9, in do_GET
assert(False)
AssertionError
.
Error code explanation: 500 - Server got itself in trouble.



Note that when not sending the traceback with the following code

#!/usr/bin/env python3.3

import http.server
import traceback

class httphandler(http.server.BaseHTTPRequestHandler):
  def do_GET(self):
try:
  assert(False)
except:
  self.send_error(500)

if __name__=='__main__':
  addr=('',9000)
  http.server.HTTPServer(addr,httphandler).serve_forever()

Everything is working well.

→ telnet localhost 9000
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.1
Host: localhost:9000

HTTP/1.0 500 Internal Server Error
Server: BaseHTTP/0.6 Python/3.3.0
Date: Tue, 26 Feb 2013 23:51:46 GMT
Content-Type: text/html;charset=utf-8
Connection: close

http://www.w3.org/TR/html4/strict.dtd";>



Error response


Error response
Error code: 500
Message: Internal Server Error.
Error code explanation: 500 - Server got itself in trouble.


Connection closed by foreign host.

I'm looking at http://hg.python.org/cpython/file/3.3/Lib/http/server.py#l404

For the second part of your message. I don't think the two issues should be 
mixed. Maybe open another bug report.

--
nosy: +karlcow

___
Python tracker 

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



[issue16901] In http.cookiejar.FileCookieJar() the .load() and .revert() methods don't work

2013-02-26 Thread Demian Brecht

Changes by Demian Brecht :


--
nosy: +dbrecht

___
Python tracker 

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



[issue17251] LWPCookieJar load() set domain_specifed wrong

2013-02-26 Thread Maximiliano Curia

Changes by Maximiliano Curia :


Removed file: http://bugs.python.org/file29248/issue_17251.diff

___
Python tracker 

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



[issue17251] LWPCookieJar load() set domain_specifed wrong

2013-02-26 Thread Demian Brecht

Demian Brecht added the comment:

According to some digging around that I've done, this issue may be invalid:

(I couldn't find an RFC or detailed spec of the LWP format, so reading from 
libwww-perl source @ 
http://cpansearch.perl.org/src/GAAS/libwww-perl-5.836/lib/HTTP/Cookies.pm)

# Try with a more general domain, alternately stripping
# leading name components and leading dots.  When this
# results in a domain with no leading dot, it is for
# Netscape cookie compatibility only:
#
# a.b.c.net Any cookie
# .b.c.net  Any cookie
# b.c.net   Netscape cookie only
# .c.netAny cookie

So, www.domain.com is not a valid LWP domain and therefore, unless I'm missing 
something, the module is functioning as expected.

--
nosy: +dbrecht

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread R. David Murray

R. David Murray added the comment:

Well, we're a bit more nuanced about backward compatibility than that :)

I doubt that people *intentionally* rely on the behavior, true, so a change 
could conceivably be made in a new release.

At this point you need to take your arguments to python-ideas or python-dev 
(probably the latter), where the people who built this PEP and its 
implementation can address your concerns better than I can.  I could be wrong, 
since I'm just a user of generators, not one of the implementors.

--

___
Python tracker 

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



[issue17302] HTTP/2.0 - Implementations/Testing efforts

2013-02-26 Thread karl

karl added the comment:

agreed on HTTP/1.1, is there a plan to fix it too ;) because the current 
http.server seems to be untouchable without breaking stuff all around :)

--

___
Python tracker 

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



[issue16039] imaplib: unlimited readline() from connection

2013-02-26 Thread Emil Lind

Emil Lind added the comment:

I'm uploading my first patch. 
Heavily based on the related issues for ftplib and poplib.
Need help with review and a few questions...

Q1: Is the error Exception the right way to handle the "breach" (disconnects 
client?) or is there a better way? Like a 'BAD' response...

Q2: I'm not sure how to best modify the test_imaplib for this patch. I'm 
guessing a make_server where the client gets MAXLINE+1 bytes of data and 
validates exception. But it's above my abilities right now...

I welcome any input, thanks. 

note: patch seems to apply to 2.7, 3.2, 3.3, 3.4

--
keywords: +patch
nosy: +Emil.Lind
Added file: http://bugs.python.org/file29254/imaplib.issue16039.patch

___
Python tracker 

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



[issue17304] Fix test discovery for test_hash.py

2013-02-26 Thread Zachary Ware

Changes by Zachary Ware :


--
components: Tests
files: test_hash_discovery.diff
keywords: patch
nosy: brett.cannon, ezio.melotti, zach.ware
priority: normal
severity: normal
status: open
title: Fix test discovery for test_hash.py
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29253/test_hash_discovery.diff

___
Python tracker 

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



[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-02-26 Thread STINNER Victor

STINNER Victor added the comment:

"It was discussed to add new formats for UCS1, UCS2 and UCS4 formats to the 
array module, but nobody implemented the idea. The "u" format is kept unchanged 
(use Py_UNICODE / wchar_t) for backward compatibility with Python 3.2."

See also issue #13072 for this discussion.

--

___
Python tracker 

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



[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 66e9d0185b0f by Victor Stinner in branch '3.3':
Issue #17223: Fix test_array on Windows (16-bit wchar_t/Py_UNICODE)
http://hg.python.org/cpython/rev/66e9d0185b0f

New changeset 5aaf6bc1d502 by Victor Stinner in branch 'default':
(Merge 3.3) Issue #17223: Fix test_array on Windows (16-bit wchar_t/Py_UNICODE)
http://hg.python.org/cpython/rev/5aaf6bc1d502

--

___
Python tracker 

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



[issue17303] Fix test discovery for test_future*

2013-02-26 Thread Zachary Ware

Zachary Ware added the comment:

Correction: ...all instances of support.unload *in test_future.py* with 
support.CleanImport...

--

___
Python tracker 

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



[issue17303] Fix test discovery for test_future*

2013-02-26 Thread Zachary Ware

New submission from Zachary Ware:

Here's the fix for test discovery of test_future* (particularly test_future3).  
Without the patch, running 'python -m unittest discover Lib/test/ 
"test_future*"' results in an error in test_future3.py, due to test_future.py's 
FutureTest.test_future3 removing test_future3 from sys.modules by way of 
support.unload.  The patch replaces all instances of support.unload with a 
support.CleanImport context manager.

The patch also replaces test_main() in all test_future*.py modules, just for 
good measure.

--
components: Tests
files: test_future_discovery.diff
keywords: patch
messages: 183092
nosy: brett.cannon, ezio.melotti, zach.ware
priority: normal
severity: normal
status: open
title: Fix test discovery for test_future*
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29252/test_future_discovery.diff

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread Christopher King

Christopher King added the comment:

> I hear what you are saying, but the "generalization" does not mean
> that they work exactly the same way.

Correct.  But it does mean that the functionality of one (generator 
expressions) is a superset of the functionality of the other (list 
comprehensions).  That is currently not the case.

> The whole point of generators is that execution is lazy, which is
> what leads to the difference in behavior.

No.  That the innermost generator isn't closed over its free variables is what 
leads to the difference in behavior.

> The generator function *is* closed over the free variables.  That's
> what leads to the difference in behavior: the generator uses the
> value the free variable has when the generator executes.

We're using the term "closure" in two different ways.  Coming from a FP 
background (where comprehensions first found their way into programming 
languages), I mean it to close over the value of the variable.  I understand 
that in Python it closes over the variable itself.  In the context of a 
comprehension, I claim that the latter is useless and surprising behavior.

> I don't believe there is any practical way to implement what you are
> suggesting

Again, please see the example in my original post.  The generic algorithm is 
simple: for every generator expression syntactically nested inside another, 
walk the AST of the inner generator expression's output expression.  Do not 
enter lambdas.  Recursively apply this algorithm for any generator expressions 
syntactically nested in the inner generator expression.  For every variable 
referenced which is not bound by the inner generator expression, add it as a 
parameter to the generated inner generator function, and add it as an argument 
when calling the inner generator function from the outer generator function.

> even if we wanted to...which we would not be, since it would
> constitute a backward incompatible change in behavior.

You can't honestly tell me anyone relies on the current behavior of nested 
generators.

Furthermore, my assertion is that the current behavior is in violation of the 
language specification.  If "backward-incompatible changes in behavior" was a 
legitimate excuse for refusing to remedy implementation/specification 
disparities, then it would apply to every Python bug ever.

--

___
Python tracker 

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



[issue17267] datetime.time support for '+' and 'now'

2013-02-26 Thread Joar Wandborg

Joar Wandborg added the comment:

New patch, removed whitespace change and unnecessary test.

add_time_timedelta arg `factor` will not be changed, in order to preserve 
uniformity.

--
Added file: http://bugs.python.org/file29251/issue17267-v3.patch

___
Python tracker 

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



[issue17302] HTTP/2.0 - Implementations/Testing efforts

2013-02-26 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Yes, feature complete of 1.1 will be a start. :(

--
nosy: +orsenthil

___
Python tracker 

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



[issue10572] Move test sub-packages to Lib/test

2013-02-26 Thread Ned Deily

Ned Deily added the comment:

Geoff, thanks, it is documented elsewhere in the devguide but it should be 
mentioned there as well.  I've added a note to Issue16931.

--

___
Python tracker 

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



[issue17302] HTTP/2.0 - Implementations/Testing efforts

2013-02-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

It should certainly be done outside of python.org.
Also, I think the stdlib already lacks some HTTP/1.1 features, better start 
there...

--
nosy: +pitrou

___
Python tracker 

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



[issue16931] mention work-around to create diffs in default/non-git mode

2013-02-26 Thread Ned Deily

Ned Deily added the comment:

However this is resolved, the information in the devguide should be consistent. 
 AFAICT, the recommendation to use hg "git" format is currently only mentioned 
in the Committing section 
(http://docs.python.org/devguide/committing.html#minimal-configuration) but not 
elsewhere, in particular, not http://docs.python.org/devguide/patch.html. (This 
was brought up in Issue10572.) Perhaps both sections could reference a FAQ 
entry which includes the Rietveld caveats.

--
nosy: +ned.deily

___
Python tracker 

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



[issue17302] HTTP/2.0 - Implementations/Testing efforts

2013-02-26 Thread karl

New submission from karl:

Are there plans to develop an HTTP/2.0 library in parallel of the specification 
development? It will not be ready before years, but it would be good to have an 
evolving implementation. Or should it be done outside of python.org?

Reference: https://github.com/http2

--
components: Library (Lib)
messages: 183086
nosy: karlcow
priority: normal
severity: normal
status: open
title: HTTP/2.0 - Implementations/Testing efforts
versions: Python 3.4

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread R. David Murray

R. David Murray added the comment:

To be honest I don't understand the sentence from Guido that you are quoting 
(even reading the issue I don't think I have the full context), but what we 
wound up with was what he wound up wanting.

--

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread R. David Murray

R. David Murray added the comment:

I hear what you are saying, but the "generalization" does not mean that they 
work exactly the same way.  The whole point of generators is that execution is 
lazy, which is what leads to the difference in behavior.  

The generator function *is* closed over the free variables.  That's what leads 
to the difference in behavior: the generator uses the value the free variable 
has when the generator executes.  I don't believe there is any practical way to 
implement what you are suggesting, even if we wanted to...which we would not 
be, since it would constitute a backward incompatible change in behavior.

Note also that this behavior of closures is not unique to Python.  See for 
example http://www.javascriptkit.com/javatutors/closures2.shtml.

--

___
Python tracker 

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



[issue17301] An in-place version of many bytearray methods is needed

2013-02-26 Thread Gregory P. Smith

New submission from Gregory P. Smith:

bytearray has many methods that return a *new* bytearray object rather than 
applying the transformation to modify the bytearray in place.  Given that one 
use of bytearray's is to avoid making extra copies... There should be in-place 
variants of the following methods:

ljust
lower
lstrip
rjust
rstrip
strip
swapcase
title
translate
upper

especially so for the methods that don't change the length or move data around 
such as translate, lower, upper, swapcase and title.

--
components: Interpreter Core
keywords: easy
messages: 183082
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: An in-place version of many bytearray methods is needed
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue12641] Remove -mno-cygwin from distutils

2013-02-26 Thread Martin Fiers

Martin Fiers added the comment:

Dear Eric,

I never said that anyone of these volunteers is 
unresponsible/stupid/whatsoever. It was also never my intention to express 
myself in this way, so I apologize if you felt harmed in any way. I was just 
suprised that this issue exists for so long. And since I only recently started 
developing on Windows, I was a bit knocked over by the additional effort that 
was needed to get things working (for which I blame Windows, not Python!). I've 
been developing for some time now and I understand completely that it's far 
from trivial; given the complexity of the software and fragility of distutils. 
So kudos to the developers that put their hours into this! 

Anyway, I have a workaround using some distutils manipulations now (see my 
previous post), which works for now, and I'm looking forward to a permanent fix!

With best regards,
Martin

--

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread Christopher King

Christopher King added the comment:

Quote from Guido:

"""In general the value of every free variable used anywhere 
except in the outer expression should be captured; [...] This 
should give the least surprising semantics in a variaty of use 
cases."""

Source: http://bugs.python.org/issue872326#msg45190

--

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread Christopher King

Christopher King added the comment:

Only the implementation of *generators* needs to change to remedy this bug.  
Please see the example I included.  By closing the generated generator function 
over free the free variables in the generator expression, you can avoid dynamic 
scoping entirely and provide expected behavior.

The reason I claim this behavior is surprising and incorrect is because 
generator expressions are touted as being able to replace list comprehensions, 
when in fact they are not due to this bug.  Even the generator expression PEP 
claims: "This PEP introduces generator expressions as a high performance, 
memory efficient generalization of list comprehensions".

Until this bug is fixed, generator expressions are NOT a generalization of list 
comprehensions, and hence CPython is in violation of the PEP as accepted.

--

___
Python tracker 

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



[issue10572] Move test sub-packages to Lib/test

2013-02-26 Thread Geoff Wilson

Geoff Wilson added the comment:

Attach updated patch for lib2to3 (issue10572-lib2to3-2.patch)

--
Added file: http://bugs.python.org/file29250/issue10572-lib2to3-2.patch

___
Python tracker 

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




[issue12641] Remove -mno-cygwin from distutils

2013-02-26 Thread Éric Araujo

Éric Araujo added the comment:

> I don't understand; so many people depend on it and yet an out-of-the-box 
> solution doesn't work.

It is because of the combinations of some facts:
- Python contributors are volunteers;
- distutils is used a lot and quite brittle, which is a combination that makes 
us extremely cautious with changes;
- I am not a Windows user or developer;
- Martin knows Windows but apparently not Cygwin;
- nobody submitted patches until this month;
- nobody reviewed patches after they were attached.

You can choose to believe that we are unresponsible, stupid, etc. or accept 
that in an open, volunteer-based project, subtle changes in a niche part of the 
code are not committed right away.  Whatever we do, we get blamed for moving 
too slowly and for changing Python too fast (not by the same people :).

The good news is that Roumev submitted clear patches, and that Trent Nelson put 
together Snakebite, a set of computers for Python developers that run various 
OSes including Windows.  Using these machines to test the patches, we can now 
make progress.

--
versions: +Python 3.4

___
Python tracker 

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



[issue14720] sqlite3 microseconds

2013-02-26 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Fixed.

--

___
Python tracker 

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



[issue10572] Move test sub-packages to Lib/test

2013-02-26 Thread Geoff Wilson

Geoff Wilson added the comment:

Thanks Ned! Attached is an update for sqlite tests with the right patch format 
(issue10572-sqlite3-2.patch).

May make sense to mention the hg diff --git format in:
http://docs.python.org/devguide/patch.html

--
Added file: http://bugs.python.org/file29249/issue10572-sqlite3-2.patch

___
Python tracker 

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



[issue14720] sqlite3 microseconds

2013-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset eb45fd74db34 by Petri Lehtinen in branch '2.7':
Issue #14720: Enhance sqlite3 microsecond conversion, document its behavior
http://hg.python.org/cpython/rev/eb45fd74db34

New changeset ae25a38e6c17 by Petri Lehtinen in branch '3.2':
Issue #14720: Enhance sqlite3 microsecond conversion, document its behavior
http://hg.python.org/cpython/rev/ae25a38e6c17

New changeset 17673a8c7083 by Petri Lehtinen in branch '3.3':
Issue #14720: Enhance sqlite3 microsecond conversion, document its behavior
http://hg.python.org/cpython/rev/17673a8c7083

New changeset 0db66afbd746 by Petri Lehtinen in branch 'default':
Issue #14720: Enhance sqlite3 microsecond conversion, document its behavior
http://hg.python.org/cpython/rev/0db66afbd746

--

___
Python tracker 

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



[issue16930] mention limitations and/or alternatives to hg graft

2013-02-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> To clarify my original comment, I got an error about
> ConfigParser.py/configparser.py even when that file was not part of the 
> change.

Would you mind reporting a Mercurial bug then? (http://bz.selenic.com/)

As for mentioning it in the devguide, I don't think we want to mention every 
other utility's quirk.

--
nosy: +pitrou

___
Python tracker 

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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread R. David Murray

R. David Murray added the comment:

The behavior is deeply baked into how Python does closures and scoping. It 
shows up elsewhere than generators (eg: nested function definitions; usually 
encountered when using lambdas).  So, this behavior isn't going to change, it's 
just one of a relatively small handful of odd things you have to learn in order 
to grok Python.  (And yes, it is surprising...that's why there's a FAQ for it.)

--
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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread Christopher King

Christopher King added the comment:

Also tested and broken in Py3k.

--
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



[issue7423] nested generator expression produces strange results

2013-02-26 Thread Christopher King

Christopher King added the comment:

This is a crazy and unexpected behavior.  (Moreover, the fact that Python has 
dynamic scope *only if you forget to initialize a variable* is even more crazy 
and unexpected.)  To provide unsurprising behavior (i.e. behavior compatible 
with that of a list comprehension) the generator above should "unwrap" (i.e. 
reduce) to:

def g1(x):
for y in 'c':
yield x+y
l = []
for x in 'ab':
l.append(g1(x))
print l
print map(list, l)

i.e. the variables referenced by, but not initialized by, the innermost 
generator should add extra parameters to the generated generator function.

--
nosy: +Christopher.King

___
Python tracker 

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



[issue17283] Lib/test/__main__.py should share code with regrtest.py

2013-02-26 Thread Petri Lehtinen

Petri Lehtinen added the comment:

LGTM.

--

___
Python tracker 

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



[issue17299] Test cPickle with real files

2013-02-26 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue17251] LWPCookieJar load() set domain_specifed wrong

2013-02-26 Thread Maximiliano Curia

Maximiliano Curia added the comment:

Hi,

This is still present in the current mercurial.

I'm attaching a patch that fixes the issue.

Thanks.

--
keywords: +patch
nosy: +m...@debian.org
versions: +Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file29248/issue_17251.diff

___
Python tracker 

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



[issue17290] pythonw - loading cursor bug when launching scripts

2013-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5fddaa709d6b by Vinay Sajip in branch '3.3':
Closes #17290: Loading cursor now does not persist when launching GUI scripts.
http://hg.python.org/cpython/rev/5fddaa709d6b

New changeset 0d55fb0217f1 by Vinay Sajip in branch 'default':
Closes #17290: Merged fix from 3.3.
http://hg.python.org/cpython/rev/0d55fb0217f1

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> 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



[issue17290] pythonw - loading cursor bug when launching scripts

2013-02-26 Thread Vinay Sajip

Vinay Sajip added the comment:

Plus, the standalone launcher has already been updated (the version displayed 
in the installer and the resource version should be 1.0.1.2):

https://bitbucket.org/vinay.sajip/pylauncher/downloads

--

___
Python tracker 

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



[issue17290] pythonw - loading cursor bug when launching scripts

2013-02-26 Thread netrick

netrick added the comment:

Vinay, is there a chance that the fix will be included in 3.3.1?

If not, is there a chance to create a python 3.3 installer with the patched 
pyw.exe? As I know nothing of python packaging so I have no idea how to do it 
and it would be very handy for me.

--

___
Python tracker 

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



[issue17263] crash when tp_dealloc allows other threads

2013-02-26 Thread Albert Zeyer

Albert Zeyer added the comment:

Btw., this turns out to be at least 4 kind of separate bugs:

1. The crash from the testcase - when the interpreter shuts down.

2. Maybe the crash from my musicplayer app - if that is a different one. But 
very related to the first one.

3. Many loops over the thread states could have code inside which might release 
the GIL. All these loops can crash because the thread state could be 
invalidated in the meanwhile.

4. Possible deadlock with HEAD_LOCK usage.

Should we make separate issue reports for each?

--

___
Python tracker 

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



[issue17290] pythonw - loading cursor bug when launching scripts

2013-02-26 Thread netrick

netrick added the comment:

Mark, you are my hero! I can't believe it got fixed that fast.

I confirm that for me, the fix works. I just replaced pyw.exe in python33 
folder and the bug is gone.

--

___
Python tracker 

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



[issue13772] listdir() doesn't work with non-trivial symlinks

2013-02-26 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Thanks for the suggestions.

> Antoine Pitrou added the comment:
>
> From an implementation standpoint, I would indeed prefer the path handling
> functions to be written in Python.

Is there an example of how a function like win32_symlink could call into 
ntpath.dirname()? I believe the reason we did not invoke ntpath was due to a 
possible race condition where the Python interpreter might not be fully started 
before os.symlink is invoked. Perhaps there are mitigating factors, but I'm not 
familiar enough with the Python internals to know what's safe and what is not 
(or even how to invoke that behavior).

> From a principle standpoint, I'm not sure it's a good idea for os.symlink()
> to be non-atomic (there's a small race condition between reading the target's
> attributes and creating the actual symlink).

I agree there exists a small possibility of a race condition here. I believe 
this race condition is of little concern to the vast majority of use-cases. For 
those use cases where a race condition might be a factor, the 
target_is_directory parameter may be supplied by that code to overcome the 
condition.

Furthermore, since the Windows APIs don't provide a way to match the symlink 
creation with its target, it's not possible to avoid this race condition.

> Also, since in general you always know whether you're making a link to a
> directory or a file, I'm not sure auto-detection is really a plus (except 
> that it
> makes things more familiar for Unix developers).

For the vast majority of use cases, target detection will behave much like 
symlinks do in Unix, which allows os.symlink to be used portably without 
specifically accounting for Windows behavior. I'm not as concerned about 
Windows programmers using Python (who might not mind specifying the 
directory-ness of their targets), but Python programs written by Unix 
developers running on Windows. In the latter use-case, it's much harder to have 
those programs adopt an additional parameter to support Windows. I could 
imagine some library maintainers rejecting a patch that includes 
target_is_directory just because it's not elegant and seems unnecessary from a 
Unix programmer's perspective. For that use case and in order to support the 
general expectation that os.symlink should provide the most uniform behavior it 
can, the directory detection is highly valuable.

Indeed, both your initial usage of the function and Larry Hastings' initial 
reaction betray the expectation that os.symlink should create a directory-type 
symlink when the target is a directory. I don't see how it's not a huge plus to 
support a developer's expectations when possible.

Personally, I would prefer to not have the parameter at all. Unfortunately, to 
support cases where one might need to create directory symlinks to non-existent 
targets, the parameter is necessary. However, I'd like to limit its required 
usage to only the cases where it's necessary.

> I'm not against restoring detection, but it should be non-buggy and
> correctly unit-tested :)

I'd like to focus on restoring detection, which was vetted and approved in the 
original implementation. Obviously, I can't guarantee that it doesn't have 
additional bugs. Provably-correct code is expensive and way outside the scope 
of this effort. As you could see from your patch, there were tests capturing 
the desired behavior. That test has been restored. Additionally, this patch 
includes a new test to capture the case of a non-local link (a behavior that 
was never tested for Unix symlinks).

--

___
Python tracker 

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



[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-02-26 Thread STINNER Victor

STINNER Victor added the comment:

On Windows, test_array can use an invalid surrogate pair to test this
issue: b'\xff\xdf\x61\x00' for example.

I don't know how to easily check the size of wchar_t.
ctypes.sizeof(ctypes.c_wchar) can be used, but ctypes is not always
available. sys.unicode is now always 0x10 since Python 3.3.
PyUnicode_GetMax() is not accessible in Python.

--

___
Python tracker 

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



[issue11367] xml.etree.ElementTree.find(all): docs are wrong

2013-02-26 Thread anatoly techtonik

anatoly techtonik added the comment:

Thanks for working on this. It is always nice to see things moving.

--

___
Python tracker 

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



[issue7358] cStringIO not 64-bit safe

2013-02-26 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue13772] listdir() doesn't work with non-trivial symlinks

2013-02-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> I'm not super-confident about the implementation of the
> path-manipulation functions, and I would prefer to use the Python
> implementations of the path-manipulation (dirname and join) instead.
> If there are any suggestions in this regard, I'd appreciate them.

>From an implementation standpoint, I would indeed prefer the path handling
functions to be written in Python.

>From a principle standpoint, I'm not sure it's a good idea for os.symlink()
to be non-atomic (there's a small race condition between reading the target's
attributes and creating the actual symlink).

Also, since in general you always know whether you're making a link to a
directory or a file, I'm not sure auto-detection is really a plus (except
that it makes things more familiar for Unix developers).

--

___
Python tracker 

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



[issue13555] cPickle MemoryError when loading large file (while pickle works)

2013-02-26 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue15083] Rewrite ElementTree tests in a cleaner and safer way

2013-02-26 Thread Eli Bendersky

Eli Bendersky added the comment:

Great, thanks.

Now looking forward to the patch getting rid of the module-level globals. One 
idea is explicitly pass the module into each testing class. The classes should 
not rely on anything global in this respect.

--

___
Python tracker 

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



[issue13772] listdir() doesn't work with non-trivial symlinks

2013-02-26 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Please disregard the patch 8bf88b31ebb7.

Antoine, Brian, or anyone else - would you please review the attached patch 
(b744517b90bc.diff)? It adds a test for creating directory symlinks that are 
non-local (don't depend on the current directory for reference), backs out 
Antoine's changes, and replaces them with directory detection that fixes this 
issue while maintaining directory detection.

I'm not super-confident about the implementation of the path-manipulation 
functions, and I would prefer to use the Python implementations of the 
path-manipulation (dirname and join) instead. If there are any suggestions in 
this regard, I'd appreciate them.

That said, the tests now pass for me on Windows (and I don't see why the tests 
wouldn't also pass on Linux).

--
Added file: http://bugs.python.org/file29247/b744517b90bc.diff

___
Python tracker 

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



[issue17263] crash when tp_dealloc allows other threads

2013-02-26 Thread Albert Zeyer

Albert Zeyer added the comment:

> > Wouldn't it be better to expose and re-use the HEAD_LOCK and HEAD_UNLOCK
> > macros from pystate.c?

> I don't like holding locks before calling "alien" code, it's a recipe
> for deadlocks: for example, if another thread-local object was
> deallocated as part of the deallocation chain, we would call back into
> local_clear(), and deadlock.

Ah, yes. Right now, the head-lock is acquired while the GIL is held. So while 
the head-lock is held, we must not unlock the GIL. So this wouldn't work.

Btw., I think it also does happen already. While playing around with this test 
case, I sometimes encountered a deadlock at quit. I was thinking that it was 
the result of some badly written memory.

But I just saw this code (PyInterpreterState_Clear):

HEAD_LOCK();
for (p = interp->tstate_head; p != NULL; p = p->next)
PyThreadState_Clear(p);
HEAD_UNLOCK();

So, if something inside PyThreadState_Clear unlocks the GIL and some other 
thread acquires the GIL and then tries to HEAD_LOCK (for example, at thread 
exit), you have a classic deadlock.

A solution would be: Only acquire the head-mutex while the GIL is not held. 
Then, after you held the head-mutex, also acquire the GIL.

--

___
Python tracker 

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



[issue11367] xml.etree.ElementTree.find(all): docs are wrong

2013-02-26 Thread Eli Bendersky

Eli Bendersky added the comment:

Henrik. Yes, I think the change in 3.3 was intentional in order to avoid 
duplication that can be a source of errors. If ET.find() does exactly what 
ET.getroot().find() does, it suffices to mention it with a link. Since Element 
docs come first and arguably Element's methods are much more widely used, I 
think it's a good tradeoff. Any duplication is yet another place to remember 
fixing when problems in the documentation are discovered (like the original 
problem leading to this issue).

So for consistency you can make all methods point to Element's methods (just 
backport 3.3's version, but please verify that the code behavior is indeed as 
documented in earlier versions).

--

___
Python tracker 

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



[issue13772] listdir() doesn't work with non-trivial symlinks

2013-02-26 Thread Jason R. Coombs

Jason R. Coombs added the comment:

I tried the create-patch function, but it didn't work against bitbucket 
(produced an empty diff). So I'm attaching a diff explicitly.

--
Added file: http://bugs.python.org/file29246/8bf88b31ebb7.diff

___
Python tracker 

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



[issue17223] Initializing array.array with unicode type code and buffer segfaults

2013-02-26 Thread Richard Oudkerk

Richard Oudkerk added the comment:

The new test seems to be reliably failing on Windows:

==
FAIL: test_issue17223 (__main__.UnicodeTest)
--
Traceback (most recent call last):
  File "C:\Repos\cpython-dirty\lib\test\test_array.py", line 1075, in 
test_issue17223
self.assertRaises(ValueError, a.tounicode)
AssertionError: ValueError not raised by tounicode

--

--
nosy: +sbt
status: closed -> open

___
Python tracker 

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



[issue17263] crash when tp_dealloc allows other threads

2013-02-26 Thread Charles-François Natali

Charles-François Natali added the comment:

> Wouldn't it be better to expose and re-use the HEAD_LOCK and HEAD_UNLOCK
> macros from pystate.c?

I don't like holding locks before calling "alien" code, it's a recipe
for deadlocks: for example, if another thread-local object was
deallocated as part of the deallocation chain, we would call back into
local_clear(), and deadlock.

> That said, I doubt this is the issue here. We are removing a string key 
> pointing
> to a localdummy object. Both are small atomic types not handled by the GC, so
> I don't see how deallocating these objects could release the GIL.

Yes, it shouldn't happen, the thread local dict is deallocated right
before (I initially thought the thread local dict was deallocated
here).

Without a proper backtrace, i'ts going to be hard to debug...

--

___
Python tracker 

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



[issue17018] Inconsistent behaviour of methods waiting for child process

2013-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 92003d9aae0e by Richard Oudkerk in branch '2.7':
Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR.
http://hg.python.org/cpython/rev/92003d9aae0e

New changeset 5fae31006724 by Richard Oudkerk in branch '3.2':
Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR.
http://hg.python.org/cpython/rev/5fae31006724

--
nosy: +python-dev

___
Python tracker 

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



[issue13772] listdir() doesn't work with non-trivial symlinks

2013-02-26 Thread Jason R. Coombs

Changes by Jason R. Coombs :


Added file: http://bugs.python.org/file29245/8bf88b31ebb7.diff

___
Python tracker 

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



[issue13772] listdir() doesn't work with non-trivial symlinks

2013-02-26 Thread Jason R. Coombs

Changes by Jason R. Coombs :


--
hgrepos: +177

___
Python tracker 

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



[issue13772] listdir() doesn't work with non-trivial symlinks

2013-02-26 Thread Jason R. Coombs

Changes by Jason R. Coombs :


--
hgrepos:  -176

___
Python tracker 

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



[issue13772] listdir() doesn't work with non-trivial symlinks

2013-02-26 Thread Jason R. Coombs

Changes by Jason R. Coombs :


--
hgrepos: +176

___
Python tracker 

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



[issue17263] crash when tp_dealloc allows other threads

2013-02-26 Thread Albert Zeyer

Albert Zeyer added the comment:

> Wouldn't it be better to expose and re-use the HEAD_LOCK and HEAD_UNLOCK 
> macros from pystate.c?

The macro-names HEAD_LOCK/HEAD_UNLOCK irritates me a bit. Protecting only the 
head would not be enough. Any tstate object could be invalidated. But actually, 
it protects any modification on the list (both in tstate_delete_common and in 
new_threadstate), as far as I see it.

But yes, it would be a good thing to export this locking functionality so other 
code can use it.

--

___
Python tracker 

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



[issue17263] crash when tp_dealloc allows other threads

2013-02-26 Thread Albert Zeyer

Albert Zeyer added the comment:

Btw., where we are at this issue - I have seen many more loops over the threads 
(via PyThreadState_Next). I have a bad feeling that many of these loops have 
similar issues.

In this case, I am also not sure anymore that it really was a problem. I 
originally thought that in this loop, it would delete the local-dicts (which 
contained my Test-object/sqlite connection object). But it does not, it only 
deallocates a string and the dummy object there. The local-dicts were already 
been freed at Py_CLEAR(dummies).

I still tried to reproduce the crash in the testcase even when the interpreter 
is not shutting down (like it looks in my musicplayer app) but no success. I 
also wasn't able yet to get more debugging info about the musicplayer app crash.

Note that in the musicplayer app, I have the same workaround now as 
demonstrated in the testcase and there aren't any crashes anymore (so far - 
they were seldom anyway).

--

___
Python tracker 

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



[issue12641] Remove -mno-cygwin from distutils

2013-02-26 Thread Dan

Dan added the comment:

Nice partial work-around.

I think it's quite clear that the decision makers for this bug have not been 
making rational decisions for a year and a half, so we can't really expect 
change. This being the open-source world, the only recourse is publicizing the 
issue (or is there some bounty system for python?). So I suggest you blog about 
it.

--

___
Python tracker 

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



[issue10527] multiprocessing.Pipe problem: "handle out of range in select()"

2013-02-26 Thread Richard Oudkerk

Changes by Richard Oudkerk :


--
resolution:  -> fixed
stage: commit review -> 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



[issue16612] Integrate "Argument Clinic" specialized preprocessor into CPython trunk

2013-02-26 Thread Larry Hastings

Larry Hastings added the comment:

write_clinic_file tells Clinic to start writing to the clinic file, which I 
think is best to do at the very top of the file.  include_clinic_file spits out 
the #include, which you probably want near the bottom of the file, just before 
the static module declarations.  You can't put the #include at the top because 
it may refer to typedefs declared further down. 

Antoine Pitrou  wrote:

>
>Antoine Pitrou added the comment:
>
>> * Antoine: I've implemented shunting the bulk of Argument Clinic's
>>   output into a separate file.  Please see Modules/zlibmodule.c
>>   and Modules/zlibmodule_clinic.c for more.
>
>Interesting, thanks :-)
>Why do you need both clinic.write_clinic_file() and 
>clinic.include_clinic_file() ?
>
>> I don't suppose we can get some decisions made and some code checked
>> in before the PyCon sprints...?
>
>I suppose that depends on how quick everyone is.
>But code can be written before the PEP is finally accepted, of course.
>
>--
>title: Integrate "Argument Clinic" specialized preprocessor into CPython trunk 
>-> Integrate "Argument Clinic" specialized preprocessor into CPython trunk
>
>___
>Python tracker 
>
>___

--

___
Python tracker 

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



[issue11367] xml.etree.ElementTree.find(all): docs are wrong

2013-02-26 Thread Henrik Heimbuerger

Henrik Heimbuerger added the comment:

Eli, I tried to preserve the style (and detail) of the rest of the docs of the 
respective version. If I bring the 3.3 version of find() into 2.7, then it will 
have a lot less detail than f.e. findall() as a sibling method on the same 
class: 
http://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree

Is that intentional? If so, I'll happily provide adjusted patches.

--

___
Python tracker 

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



[issue16612] Integrate "Argument Clinic" specialized preprocessor into CPython trunk

2013-02-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> * Antoine: I've implemented shunting the bulk of Argument Clinic's
>   output into a separate file.  Please see Modules/zlibmodule.c
>   and Modules/zlibmodule_clinic.c for more.

Interesting, thanks :-)
Why do you need both clinic.write_clinic_file() and 
clinic.include_clinic_file() ?

> I don't suppose we can get some decisions made and some code checked
> in before the PyCon sprints...?

I suppose that depends on how quick everyone is.
But code can be written before the PEP is finally accepted, of course.

--
title: Integrate "Argument Clinic" specialized preprocessor into CPython trunk 
-> Integrate "Argument Clinic" specialized preprocessor  into CPython trunk

___
Python tracker 

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



[issue17263] crash when tp_dealloc allows other threads

2013-02-26 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> And here's a patch.

Wouldn't it be better to expose and re-use the HEAD_LOCK and HEAD_UNLOCK
macros from pystate.c?
That said, I doubt this is the issue here. We are removing a string key pointing
to a localdummy object. Both are small atomic types not handled by the GC, so
I don't see how deallocating these objects could release the GIL.

--

___
Python tracker 

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



[issue17300] Сrash when deleting deeply recursive iterator wrappers

2013-02-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Aha, this is a duplicate of issue14010.

--
resolution:  -> duplicate
stage: needs patch -> committed/rejected
status: open -> closed
superseder:  -> deeply nested filter segfaults

___
Python tracker 

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



[issue17300] Сrash when deleting deeply recursive iterator wrappers

2013-02-26 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And same issue with filter:

>>> it = iter([])
>>> for i in range(100):
... it = filter(None, it)
... 
>>> del it
Segmentation fault

--
title: Сrash when deleting deeply recursive islice() -> Сrash when deleting 
deeply recursive iterator wrappers

___
Python tracker 

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



[issue14010] deeply nested filter segfaults

2013-02-26 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +serhiy.storchaka
versions:  -Python 2.6, Python 3.1

___
Python tracker 

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



[issue17300] Сrash when deleting deeply recursive islice()

2013-02-26 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

http://permalink.gmane.org/gmane.comp.python.ideas/19669

>>> from itertools import islice, count
>>> it = count()
>>> for i in range(100):
... it = islice(it, 0)
... 
>>> del it
Segmentation fault

This looks very similar to the crash in tee() (issue13454).

--
assignee: serhiy.storchaka
components: Extension Modules
messages: 183041
nosy: rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Сrash when deleting deeply recursive islice()
type: crash
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue16612] Integrate "Argument Clinic" specialized preprocessor into CPython trunk

2013-02-26 Thread Stefan Behnel

Stefan Behnel added the comment:

I mentioned it in a couple of places during the discussion, you might just have 
missed them.

The code that generates the unpacking C code starts here:

https://github.com/cython/cython/blob/4ebc647c2fa54179d25335b2dcf5d845e7fc9a79/Cython/Compiler/Nodes.py#L3068

and extends to here:

https://github.com/cython/cython/blob/4ebc647c2fa54179d25335b2dcf5d845e7fc9a79/Cython/Compiler/Nodes.py#L3641

As I said, Cython actually takes its signature information from normal Python 
signatures, which you can augment with type annotations in normal C style. So 
it's not really some fancy DSL behind it, just straight forward stuff like this:

def func(a, int b, bytes c, unicode s, *, bint flag=False):
...

If you want to take a closer look, it's best to just write down a Python 
function and let Cython translate it for you to see the code that it generates 
for it.

And it's based on Cython's type system, so argument type conversions use 
Cython's support for things like copying mappings into structs, for example, or 
optimised builtin types unboxing.

--

___
Python tracker 

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



[issue16612] Integrate "Argument Clinic" specialized preprocessor into CPython trunk

2013-02-26 Thread Larry Hastings

Larry Hastings added the comment:

As a rule I'm unlikely to mention things I haven't heard about.  I've never 
used Cython, and I don't recall anyone mentioning this technology previously.  
Once skrah posts his alternative DSL proposal, I'll amend the PEP to discuss 
both these alternatives.

Can you point me to documentation on this Cython feature?

And, FWIW, the DSL was the interesting part for me.  I'm hoping someone else 
will step up and write the shiny new fast argument parsing API.  If it can be 
adapted out of existing working code, so much the better.

--

___
Python tracker 

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



[issue17296] Cannot unpickle classes derived from 'Exception'

2013-02-26 Thread Andreas Hausmann

Andreas Hausmann added the comment:

A backport to 2.7 would be in the interest of the Zope community (I dare say 
;)), at least in ours.

In our project, after having migrated to Zope 2.13/Python2.7 we found this bug 
and now we are quite worried what else might happen with our huge pickled 
database.

--

___
Python tracker 

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



[issue17296] Cannot unpickle classes derived from 'Exception'

2013-02-26 Thread Andreas Hausmann

Andreas Hausmann added the comment:

That is correct.

Under 2.4 and 3.3 it should show neither the line "EXCEPTION ## EXCEPTION" nor 
the following line "TypeError: ('__init__() takes at least 2 arguments."

That means, that in version 2.4 and 3.3 that unpickling problem doesn't exist. 
In version 2.4 I tested it myself; exactly, there is no problem. In version 3.3 
I simply take your word, that the bug is fixed.

--

___
Python tracker 

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



[issue16932] urlparse fails at parsing "www.python.org:80/"

2013-02-26 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I have fixed the docs issue. Thanks for the report and following up.

--
assignee:  -> orsenthil
keywords:  -buildbot
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue16932] urlparse fails at parsing "www.python.org:80/"

2013-02-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 33895c474b4d by Senthil Kumaran in branch '2.7':
Fix issue16932: Fix the urlparse example. Remote :port when scheme is not 
specified to demonstrate correct behavior
http://hg.python.org/cpython/rev/33895c474b4d

New changeset 5442a77b925c by Senthil Kumaran in branch '3.2':
Fix issue16932: Fix the urlparse example. Remote :port when scheme is not 
specified to demonstrate correct behavior
http://hg.python.org/cpython/rev/5442a77b925c

New changeset 8928205f57f6 by Senthil Kumaran in branch '3.3':
Fix issue16932: Fix the urlparse example. Remote :port when scheme is not 
specified to demonstrate correct behavior
http://hg.python.org/cpython/rev/8928205f57f6

New changeset 9caad461936e by Senthil Kumaran in branch 'default':
Fix issue16932: Fix the urlparse example. Remote :port when scheme is not 
specified to demonstrate correct behavior
http://hg.python.org/cpython/rev/9caad461936e

--
nosy: +python-dev

___
Python tracker 

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



[issue15034] Document best practices for exceptions

2013-02-26 Thread Ezio Melotti

Ezio Melotti added the comment:

I'm removing the "devguide" component and update the title accordingly.

--
components: +Documentation -Devguide
title: Devguide should document best practices for stdlib exceptions -> 
Document best practices for exceptions

___
Python tracker 

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



[issue17263] crash when tp_dealloc allows other threads

2013-02-26 Thread Charles-François Natali

Charles-François Natali added the comment:

And here's a patch.

--
keywords: +patch
Added file: http://bugs.python.org/file29244/thread_local_concurrent.diff

___
Python tracker 

___--- Python-3.3.0/Modules/_threadmodule.c2013-02-26 08:37:05.0 
+
+++ python/Modules/_threadmodule.c  2013-02-26 08:48:24.0 +
@@ -769,6 +769,7 @@
 local_clear(localobject *self)
 {
 PyThreadState *tstate;
+PyInterpreterState *interp;
 Py_CLEAR(self->args);
 Py_CLEAR(self->kw);
 Py_CLEAR(self->dummies);
@@ -776,13 +777,18 @@
 /* Remove all strong references to dummies from the thread states */
 if (self->key
 && (tstate = PyThreadState_Get())
-&& tstate->interp) {
-for(tstate = PyInterpreterState_ThreadHead(tstate->interp);
-tstate;
-tstate = PyThreadState_Next(tstate)) {
+&& (interp = tstate->interp)) {
+for (tstate = PyInterpreterState_ThreadHead(interp);
+ tstate;) {
 if (tstate->dict &&
-PyDict_GetItem(tstate->dict, self->key))
+PyDict_GetItem(tstate->dict, self->key)) {
 PyDict_DelItem(tstate->dict, self->key);
+/* the list of threads could have been altered, restart from
+ * the head */
+tstate = PyInterpreterState_ThreadHead(interp);
+} else {
+tstate = PyThreadState_Next(tstate);
+}
 }
 }
 return 0;
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >