[issue18745] Test enum in test_json is ignorant of infinity value

2013-08-28 Thread Ethan Furman

Ethan Furman added the comment:

The added tests for inf, -inf, and nan are good.

The refactoring of the dictionary tests are not good.  The reason is that 
before _json.c was fixed (issue18264) it would return the string value of an 
IntEnum instead of the string value of the IntEnum member's value attribute.

--> class Number(IntEnum):
...one = 1
...two = 2

--> json.dumps(Number.one)
'Number.one'  # should be '1'

As a constant we get a failure when trying to round-trip:

--> json.loads(json.dumps(Number.one))
Traceback (most recent call last):
  ...
ValueError: Expecting value: line 1 column 1 (char 0)

But as a dictionary we do not (because keys get morphed into strings):

--> json.dumps({Number.one: 'one'})
'{"Number.one": "one"}'  # should be '{"1": "one"}'

Which round-trips fine, but yields the wrong result:

>>> loads(dumps({Number.one: 'one'}))
{'Number.one': 'one'}  # should be {'1': 'one'}

So the dictionary tests (and the list tests) are there to make sure that 
json.dumps is converting them properly, not to make sure that they round-trip, 
and by changing from repr to loads/dumps the point of the test is lost.

Updated tests attached.

--
Added file: http://bugs.python.org/file31493/issue18745.stoneleaf.01.patch

___
Python tracker 

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



[issue18851] subprocess's Popen closes stdout/stderr filedescriptors used in another thread when Popen errors

2013-08-28 Thread Jeong-Min Lee

Changes by Jeong-Min Lee :


--
nosy: +Jeong-Min.Lee

___
Python tracker 

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



[issue18865] multiprocessing: remove util.pipe()?

2013-08-28 Thread STINNER Victor

New submission from STINNER Victor:

In the implementation of the PEP 446, issue #18571, I replaced 
multiprocessing.util.pipe() with os.pipe() in the multiprocessing module.

Can we remove the multiprocessing.util.pipe() function? It is not public nor 
documented.

Charles-François Natali added the comment (in issue #18571):

   14.1 --- a/Lib/multiprocessing/util.py
   14.2 +++ b/Lib/multiprocessing/util.py

   14.13  #
   14.14  # Return pipe with CLOEXEC set on fds
   14.15  #
   14.16 +# Deprecated: os.pipe() creates non-inheritable file descriptors
   14.17 +# since Python 3.4
   14.18 +#
   14.19
   14.20  def pipe():
   14.21 -import _posixsubprocess
   14.22 -return _posixsubprocess.cloexec_pipe()
   14.23 +return os.pipe()

I guess you could remove util.pipe() altogether: it wasn't part of the public 
API.

--
messages: 196354
nosy: haypo, neologix, sbt
priority: normal
severity: normal
status: open
title: multiprocessing: remove util.pipe()?
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



[issue18571] Implementation of the PEP 446: non-inheritable file descriptors

2013-08-28 Thread STINNER Victor

STINNER Victor added the comment:

> I guess you could remove util.pipe() altogether: it wasn't part of the public 
> API.

Ah yes, I wanted to create an issue for that but I forgot. Here you
have: issue #18865.

--

___
Python tracker 

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



[issue18849] Failure to try another name for tempfile when directory with chosen name exists on windows

2013-08-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage:  -> needs patch
versions: +Python 2.7, 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



[issue18861] Problems with recursive automatic exception chaining

2013-08-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue18738] String formatting (% and str.format) issues with Enum

2013-08-28 Thread Ethan Furman

Ethan Furman added the comment:

On 08/14/2013 09:27 PM, on PyDev, Nick Coghlan wrote:
> For enums, I believe they should be formatted like their
> base types (so !s and !r will show the enum name, anything without
> coercion will show the value).

I agree.  While one of the big reasons for an Enum type was the pretty str and 
repr, I don't see format in that area.


So, these are some of the ways we have to display an object:

str()   calls obj.__str__()
repr()  calls obj.__repr__()

"%s"calls obj.__str__()
"%r"calls obj.__repr__()
"%d"calls... not sure, but we see the int value

"{}".format()  should (IMO) also display the value of the object

Using int as the case study, its presentation types are ['b', 'd', 'n', 'o', 
'x', 'X'].  Notice there is no 's' nor 'r' in there, as int expects to display 
a number, not arbitrary text.

So, for mixed-type Enumerations, I think any format calls should simply be 
forwarded to the mixed-in type (unless, of course, a custom __format__ was 
specified in the new Enumeration).

Patch attached.

--
nosy: +ncoghlan
Added file: http://bugs.python.org/file31494/issue18738.stoneleaf.03.patch

___
Python tracker 

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



[issue18866] Invitation to connect on LinkedIn

2013-08-28 Thread Mathieu Dutour Sikiric

New submission from Mathieu Dutour Sikiric:

LinkedIn


Python,

I'd like to add you to my professional network on LinkedIn.

- Mathieu

Mathieu Dutour Sikiric
visitor at Technische Universität Darmstadt
Croatia

Confirm that you know Mathieu Dutour Sikiric:
https://www.linkedin.com/e/-3qcne3-hkwae47b-w/isd/16114407170/_uBqO9cI/?hs=false&tok=1LB6yqjv-xn5U1

--
You are receiving Invitation to Connect emails. Click to unsubscribe:
http://www.linkedin.com/e/-3qcne3-hkwae47b-w/z2oU7dKDzpt2G7xQz2FC2SclHmnUGzmsk0c/goo/report%40bugs%2Epython%2Eorg/20061/I5360506395_1/?hs=false&tok=2-0L5OcgWxn5U1

(c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.

--
messages: 196357
nosy: mathieu37
priority: normal
severity: normal
status: open
title: Invitation to connect on LinkedIn

___
Python tracker 

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



[issue18866] Invitation to connect on LinkedIn

2013-08-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
Removed message: http://bugs.python.org/msg196357

___
Python tracker 

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



[issue18866] spam

2013-08-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed
title: Invitation to connect on LinkedIn -> spam

___
Python tracker 

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



[issue18867] Invitation to connect on LinkedIn

2013-08-28 Thread Mathieu Dutour Sikiric

New submission from Mathieu Dutour Sikiric:

LinkedIn


Python,

I'd like to add you to my professional network on LinkedIn.

- Mathieu

Mathieu Dutour Sikiric
visitor at Technische Universität Darmstadt
Croatia

Confirm that you know Mathieu Dutour Sikiric:
https://www.linkedin.com/e/-3qcne3-hkwamgk2-6i/isd/16114407170/_uBqO9cI/?hs=false&tok=2qk9t5ByeDn5U1

--
You are receiving Invitation to Connect emails. Click to unsubscribe:
http://www.linkedin.com/e/-3qcne3-hkwamgk2-6i/z2oU7dKDzpt2G7xQz2FC2SclHmnUGzmsk0c/goo/report%40bugs%2Epython%2Eorg/20061/I5360539519_1/?hs=false&tok=0MVwAfDXCDn5U1

(c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.

--
messages: 196358
nosy: mathieu37
priority: normal
severity: normal
status: open
title: Invitation to connect on LinkedIn

___
Python tracker 

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



[issue18867] Invitation to connect on LinkedIn

2013-08-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
Removed message: http://bugs.python.org/msg196358

___
Python tracker 

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



[issue18867] spam

2013-08-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed
title: Invitation to connect on LinkedIn -> spam

___
Python tracker 

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



[issue18868] Python3 unbuffered stdin

2013-08-28 Thread Joe Borg

New submission from Joe Borg:

I'm in need of an unbuffered stdin for Python3.  Using the '-u' flag worked 
fine in Python2.  But, it seems, Python3's stdin is always buffered; as seen in 
http://bugs.python.org/issue4705.

This is not always desirable.  For example:

#!/bin/python3
import os, subprocess, time

with open("%s/unbuffered_test.log" % (os.getenv("HOME")), "w") as f:
with subprocess.Popen(["%s/unbuffered_test.sh" % (os.getenv("HOME"))], 
stdin=subprocess.PIPE, stdout=f, stderr=f) as p:
p.stdin.write(bytes("test\n", encoding="utf-8"))
time.sleep(10)

Where unbuffered_test.sh is:
#!/bin/sh
read INPUT
echo $INPUT
exit 0

Running with -u in Python2 sees the log file populated before the 10 seconds 
are up.  This isn't the case in Python3.  This making controlling applications, 
using subprocess, basically impossible; without putting p.stdin.flush() after 
each command (which does work in the example above).

I ran this example in Python3.3.2.

--
messages: 196359
nosy: Joe.Borg
priority: normal
severity: normal
status: open
title: Python3 unbuffered stdin
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue18868] Python3 unbuffered stdin

2013-08-28 Thread Joe Borg

Changes by Joe Borg :


--
type:  -> behavior

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Michele Orrù

Michele Orrù added the comment:

> The parser *is* rejecting control characters. It's an XML parser. See the 
> example in the link you posted.
Ehrm, my apologies.

> That's not an XML specific issue. You are printing a byte string here, so 
> repr() would be the right thing to use (and is actually being used 
> automatically in 
> Py3), instead of plain printing. The fact that you are wrapping the content 
> in XML doesn't matter.
[citation needed] 
After a quick scan in the documentation I did not see anything mentioning this. 
Instead, I see many cases in which escape chars and binary-to-text encodings 
are mentioned.

> What I meant was: at what step of the process from creating an XML tree in 
> memory to serialisation is it a problem that the tree contains control 
> characters? 
> Because once the data is serialised, it will just be rejected on input by any 
> XML parser, and handling bytes data is a thing on its own (e.g. you could 
> serialise 
> to UTF16 and the result would contain null bytes - too bad).
m, I think the problem lies in the expectation of having 
fromstring(tostring(tree)) = tree

> Unless there is a more dangerous way to exploit this that is actually due to 
> XML being used, I'd suggest changing the type from "security" back to 
> "behaviour".
> Or maybe even to "enhancement". The behaviour that it writes out what you 
> give it isn't exactly wrong, it's just inconvenient that you have to take 
> care yourself 
> that you pass it well-formed XML content.
I think the point here is clarifying whether xml expect text or just a byte 
string. In case that's a stream of byte, I agree with you, is more a 
"behaviour" problem.

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Stefan Behnel

Stefan Behnel added the comment:

> I think the point here is clarifying whether xml expect text or just a byte 
> string. In case that's a stream of byte, I agree with you, is more a 
> "behaviour" problem.

XML is *defined* as a stream of bytes.

Regarding the API side in ElementTree, Py2 accepts byte strings and Py3 
requires Unicode strings. Py2 will not change in that regard, and I can't see 
this being a serious enough issue to change the ET-API there, so IMHO we can 
ignore Py2.x completely for this issue. (changing ticket accordingly)

However, Py3 will happily write out control characters if they appear in the 
Unicode text string, so the issue is the same there. A fix for Py3 would be to 
add an input validation step, preferably at serialisation time.

--
type: security -> enhancement
versions:  -Python 2.6, Python 2.7, 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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Michele Orrù

Michele Orrù added the comment:

> Incidentally I read today 
> http://blastedbio.blogspot.co.uk/2012/05/blast-tabular-missing-descriptions.html
>  mentioning ^A being used. 
> Maybe that would stop working?
I don't see any problem in any xml output. Indeed:
"You can't put a nasty non-printing ASCII character in XML, so they were 
switched to something else. That is my working theory for this anyway."

--

___
Python tracker 

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



[issue18865] multiprocessing: remove util.pipe()?

2013-08-28 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Yes I will remove it.  I was planning on doing so when PEP 446 was implemented.

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Michele Orrù

Michele Orrù added the comment:

> XML is *defined* as a stream of bytes.
Can you *paste* the *source* proving what you are arguing, please?  

> Regarding the API side in ElementTree, Py2 accepts byte strings and Py3 
> requires Unicode strings.
"accepts"? python3 works with ElementTree(bytes(unicode))

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Stefan Behnel

Stefan Behnel added the comment:

>> XML is *defined* as a stream of bytes.
> Can you *paste* the *source* proving what you are arguing, please?

http://www.w3.org/TR/REC-xml/


> python3 works with ElementTree(bytes(unicode))

What does this sentence mean?

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Michele Orrù

Michele Orrù added the comment:

>>> XML is *defined* as a stream of bytes.
>> Can you *paste* the *source* proving what you are arguing, please?
> http://www.w3.org/TR/REC-xml/
"""
The first two suggestions are directly derived from the rules given for 
identifiers in Standard Annex #31 (UAX #31) of the Unicode Standard, version 
5.0 [Unicode], and exclude all control characters, enclosing nonspacing marks, 
non-decimal numbers, private-use characters, punctuation characters (with the 
noted exceptions), symbol characters, unassigned codepoints, and white space 
characters. The other suggestions are mostly derived from Appendix B in 
previous editions of this specification.
"""

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Michele Orrù

Michele Orrù added the comment:

"""
Document authors are encouraged to avoid "compatibility characters", as defined 
in section 2.3 of [Unicode]. The characters defined in the following ranges are 
also discouraged. They are either control characters or permanently undefined 
Unicode characters:
"""

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Michele Orrù

Michele Orrù added the comment:

Does not seem to me just a "byte string" where you can put binary data. 
Hence, I expect the xml tree to escape/reject those. 
Hence, Is not an enhancement, but a bug. Unless we just want to document this.

(not going to change the metadata, otherwise we'll end up changing on each 
message).

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Stefan Behnel

Stefan Behnel added the comment:

We are talking about two different things here.

I said that (serialised) XML is defined as a sequence of bytes. Read the spec 
on that.

What you are talking about is the Infoset, or the parsed/generated in-memory 
XML tree. That's obviously not bytes, it's defined based on Unicode. Parsing 
and serialising does the mapping here.

The "attack" that you presented is based on serialised XML, thus on a sequence 
of bytes. What I am saying is that this "attack" can be done by any kind of 
binary data, so it's not XML specific, thus not a problem with ElementTree.

The fact that ElementTree allows you to generate non well-formed 'XML' 
containing control characters when you tell it to do so is unfortunate, but 
it's neither a security risk (you already had the non well-formed content in 
your hands *before* you passed it into ElementTree), nor clearly a bug, because 
the user specifically requested the serialisation of an in-memory tree that 
contained these control characters.

But, once again, it would be nice if ElementTree rejected this input in one way 
or another, and that's a feature request.

--

___
Python tracker 

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



[issue18865] multiprocessing: remove util.pipe()?

2013-08-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 38f028939028 by Richard Oudkerk in branch 'default':
Issue #18865: PEP 446 makes multiprocessing.util.pipe() unnecessary.
http://hg.python.org/cpython/rev/38f028939028

--
nosy: +python-dev

___
Python tracker 

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



[issue18855] Inconsistent README filenames

2013-08-28 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +eric.araujo, ezio.melotti, tim.peters
type:  -> enhancement

___
Python tracker 

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



[issue16799] start using argparse.Namespace in regrtest

2013-08-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is updated patch with tests.

Please open separated issues if you want suggest semantic changes (removing, 
renaming or changing behavior of some options).

--
Added file: http://bugs.python.org/file31495/regrtest_argparse_2.patch

___
Python tracker 

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



[issue18865] multiprocessing: remove util.pipe()?

2013-08-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3e397ecedc55 by Victor Stinner in branch 'default':
Issue #18865: remove unused import from multiprocessing.util.spawnv_passfds()
http://hg.python.org/cpython/rev/3e397ecedc55

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Michele Orrù

Michele Orrù added the comment:

>I said that (serialised) XML is defined as a sequence of bytes. 
> Read the spec on that.
And I'm saying that's inexact. I have expectations that control chars are 
escaped in the serialized xml, because the spec I'm reading says so, and 
because the documentation does not warn me about this.

--

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-28 Thread Richard Oudkerk

Richard Oudkerk added the comment:

The PPC64 buildbot is still failing intermittently.

--
resolution: invalid -> 
status: closed -> open

___
Python tracker 

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



[issue18865] multiprocessing: remove util.pipe()?

2013-08-28 Thread Richard Oudkerk

Changes by Richard Oudkerk :


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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-28 Thread Richard Oudkerk

Richard Oudkerk added the comment:

It looks like the main process keeps getting killed by SIGUSR1.  Don't know why.

--

___
Python tracker 

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



[issue18836] Potential race condition in exceptions

2013-08-28 Thread Sworddragon

Sworddragon added the comment:

> You may want to have a look at sys.excepthook.

This would not solve the race condition.

--

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

> It looks like the main process keeps getting killed by SIGUSR1.
> Don't know why.

In Lib/test/_test_multiprocessing.py:
"""
def test_poll_eintr(self):
got_signal = [False]
def record(*args):
got_signal[0] = True
pid = os.getpid()
oldhandler = signal.signal(signal.SIGUSR1, record)
try:
killer = self.Process(target=self._killer, args=(pid,))
killer.start()
p = self.Process(target=time.sleep, args=(1,))
p.start()
p.join()
self.assertTrue(got_signal[0])
self.assertEqual(p.exitcode, 0)
killer.join()
finally:
signal.signal(signal.SIGUSR1, oldhandler)
"""

If the _killer process takes too long to start, it won't send SIGUSR1 before 
the p process returns (0.5s vs 1s): which means that the default SIGUSR1 
handler will be restored before SIGUSR1 is sent. Then SIGUSR1 comes in, 
resulting on the failure above.

--
nosy: +neologix

___
Python tracker 

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



[issue7897] Support parametrized tests in unittest

2013-08-28 Thread Ezio Melotti

Ezio Melotti added the comment:

Since we now got subtests, can this be closed?

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Michele Orrù

Michele Orrù added the comment:

Just pointed by a friend - 
I suppose this is insanely used to put binary blobs inside xml until "only the 
CDEnd string is recognized as markup".
That's what I needed. 

Amen.

--

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fa23e49c7dd3 by Richard Oudkerk in branch 'default':
Issue #18786: Don't reinstall old SIGUSR1 handler prematurely.
http://hg.python.org/cpython/rev/fa23e49c7dd3

--
nosy: +python-dev

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-28 Thread Richard Oudkerk

Richard Oudkerk added the comment:

> If the _killer process takes too long to start, it won't send SIGUSR1 
> before the p process returns...

Thanks!

--

___
Python tracker 

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



[issue7897] Support parametrized tests in unittest

2013-08-28 Thread R. David Murray

R. David Murray added the comment:

subtests don't satisfy my use cases.  You can't run an individual subtest by 
name, and I find that to be a very important thing to be able to do during 
development and debugging.  At the moment at least I'm fine with just having my 
parameterize decorator in the email module, so I'm not motivated to move this 
forward right now.  I would like to come back to it eventually, though.

--

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

> Thanks!

You're welcome :)

BTW, I don't know if that would fulfill the goal of your test here,
but when I want to check for EINTR handling, I just use alarm (see
attached patch). The only downside is that the minimum delay is 1
second.

--
keywords: +patch
Added file: http://bugs.python.org/file31496/eintr_alarm.diff

___
Python tracker 

___--- cpython-df2fdd42b375/Lib/test/_test_multiprocessing.py  2013-08-26 
20:28:21.0 +
+++ cpython/Lib/test/_test_multiprocessing.py   2013-08-28 13:51:02.0 
+
@@ -2923,29 +2923,21 @@
 
 ALLOWED_TYPES = ('processes',)
 
-@classmethod
-def _killer(cls, pid):
-time.sleep(0.5)
-os.kill(pid, signal.SIGUSR1)
-
-@unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1')
+@unittest.skipUnless(hasattr(signal, 'alarm'), 'requires signal.alarm')
 def test_poll_eintr(self):
 got_signal = [False]
 def record(*args):
 got_signal[0] = True
 pid = os.getpid()
-oldhandler = signal.signal(signal.SIGUSR1, record)
-try:
-killer = self.Process(target=self._killer, args=(pid,))
-killer.start()
-p = self.Process(target=time.sleep, args=(1,))
-p.start()
-p.join()
-self.assertTrue(got_signal[0])
-self.assertEqual(p.exitcode, 0)
-killer.join()
-finally:
-signal.signal(signal.SIGUSR1, oldhandler)
+oldhandler = signal.signal(signal.SIGALRM, record)
+self.addCleanup(signal.signal, signal.SIGALRM, oldhandler)
+self.addCleanup(signal.alarm, 0)
+signal.alarm(1)
+p = self.Process(target=time.sleep, args=(2,))
+p.start()
+p.join()
+self.assertTrue(got_signal[0])
+self.assertEqual(p.exitcode, 0)
 
 #
 # Test to verify handle verification, see issue 3321
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17741] event-driven XML parser

2013-08-28 Thread Eli Bendersky

Eli Bendersky added the comment:

This patch implements the renaming and updates the documentation.

--
Added file: http://bugs.python.org/file31497/issue17741.api-renames.1.patch

___
Python tracker 

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



[issue18786] test_multiprocessing_spawn crashes under PowerLinux

2013-08-28 Thread Richard Oudkerk

Richard Oudkerk added the comment:

It should be fixed now so I will close.

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



[issue18868] Python3 unbuffered stdin

2013-08-28 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Try using Popen(..., bufsize=0).

--
nosy: +sbt

___
Python tracker 

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



[issue18868] Python3 unbuffered stdin

2013-08-28 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +r.david.murray
versions:  -Python 3.1, Python 3.2, Python 3.5

___
Python tracker 

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



[issue18869] test suite: faulthandler signal handler is lost

2013-08-28 Thread Charles-François Natali

New submission from Charles-François Natali:

At the beginning of the test suit execution, faulthandler registers its signal 
handler for fatal signals, as well as SIGUSR1 and SIGALRM.

The problem is that some tests temporary change those handlers, e.g. for 
EINTR-handling tests.
While they do restore the original handlers after the test, this doesn't work 
as expected because of an artifact of the signal implementation: when a signal 
handler isn't registered through the signal module (e.g. directly from C for 
faulthandler), getsignal() and setsignal() return None/SIG_DFL (depending on 
whether it was registered before or after the module initialization). Which 
means that when the test is done, it will restore the default signal handler, 
and not the faulthandler's one. Thus, any subsequent crash due to this signal 
won't benefit from faulthandler debug output, see e.g. (issue #18786):
http://buildbot.python.org/all/builders/PPC64%20PowerLinux%203.x/builds/616/steps/test/logs/stdio
"""
[310/379] test_multiprocessing_spawn
make: *** [buildbottest] User defined signal 1
/home/shager/cpython-buildarea/3.x.edelsohn-powerlinux-ppc64/build/Lib/multiprocessing/semaphore_tracker.py:121:
 UserWarning: semaphore_tracker: There appear to be 4 leaked semaphores to 
clean up at shutdown
  len(cache))
program finished with exit code 2
elapsedTime=2459.665997
"""

One way to fix this would be to add a WithSignalHandler(signal, handler) 
context manager to test.support that would replace the signal handler upon 
entry, and re-register faulthandler's handler upon exit.

--
components: Tests
messages: 196387
nosy: haypo, neologix
priority: normal
severity: normal
status: open
title: test suite: faulthandler signal handler is lost
type: behavior
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



[issue18702] Report skipped tests as skipped

2013-08-28 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy: +zach.ware

___
Python tracker 

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



[issue17741] event-driven XML parser

2013-08-28 Thread Stefan Behnel

Stefan Behnel added the comment:

Any comments regarding my naming suggestion?

Calling it a "push" parser is just too ambiguous.

--

___
Python tracker 

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



[issue17741] event-driven XML parser

2013-08-28 Thread Stefan Behnel

Stefan Behnel added the comment:

Erm, "pull" parser, but you see what I mean.

--

___
Python tracker 

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



[issue18869] test suite: faulthandler signal handler is lost

2013-08-28 Thread R. David Murray

R. David Murray added the comment:

See also issue 3948 for another variation of this problem with 
getsignal/setsignal.

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



[issue18864] Implementation for PEP 451 (importlib.machinery.ModuleSpec)

2013-08-28 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue18858] dummy_threading lacks threading.get_ident() equivalent

2013-08-28 Thread Brett Cannon

Brett Cannon added the comment:

There should actually be a test to catch the inconsistencies.

--
nosy: +brett.cannon
stage:  -> test needed

___
Python tracker 

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



[issue18869] test suite: faulthandler signal handler is lost

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Or perhaps we could enhance the signal module so that getsignal() return 
something (i.e. a specific object) which can restore the C signal handler. That 
would be better than special-casing faulthandler, IMHO.

--
nosy: +pitrou

___
Python tracker 

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



[issue18851] subprocess's Popen closes stdout/stderr filedescriptors used in another thread when Popen errors

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

Yes, the problem is that the pipes FDs are closed twice if fork() succeeds, but 
exec() fails.

They're closed in _execute_child():
  1286 if p2cread is not None and p2cwrite is not None:
  1287 os.close(p2cread)
  1288 if c2pwrite is not None and c2pread is not None:
  1289 os.close(c2pwrite)
  1290 if errwrite is not None and errread is not None:
  1291 os.close(errwrite)

And then again in Popen.__init__:
   716 if stdin == PIPE:
   717 to_close.extend((p2cread, p2cwrite))
   718 if stdout == PIPE:
   719 to_close.extend((c2pread, c2pwrite))
   720 if stderr == PIPE:
   721 to_close.extend((errread, errwrite))

--
nosy: +neologix

___
Python tracker 

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



[issue14597] Cannot unload dll in ctypes until script exits

2013-08-28 Thread Piotr Lopusiewicz

Piotr Lopusiewicz added the comment:

>>For most ctypes uses, closing is irrelevant, since people typically access 
>>system libraries that are independently loaded anyway, so closing them would 
>>not have any effect.

My use case is this: I test some things, then I need to recompile my .dll 
without closing the interpreter (as building stuff to begin tests is quiet 
expensive) then reload it. I can't recompile it because Windows blocks the .dll 
file and gcc can't overwrite it. Deleting the reference and running 
gc.collect() doesn't work.
It would be very nice to have a way to do this.

--
nosy: +Piotr.Lopusiewicz

___
Python tracker 

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



[issue18868] Python3 unbuffered stdin

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Indeed, this is not related to sys.stdin, but to Popen's own buffering, and the 
fix is either to pass "bufsize=0" or to flush() when you need to.

I'm closing as invalid, don't hesitate to re-open if I misunderstood something.

--
nosy: +pitrou
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue18851] subprocess's Popen closes stdout/stderr filedescriptors used in another thread when Popen errors

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I wonder how the closing works under Windows. os.close() is called on handles 
returned by _get_handles(), but those are Windowns HANDLE values, not C file 
descriptors: os.close() probably fails on them (don't have a Windows VM to 
check, sorry). I guess the HANDLEs are then leaked...

--

___
Python tracker 

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



[issue18851] subprocess's Popen closes stdout/stderr filedescriptors used in another thread when Popen errors

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch for 2.7. I don't know how to write a test for it, though.

--
keywords: +patch
Added file: http://bugs.python.org/file31498/subprocess_issue18851.patch

___
Python tracker 

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



[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread Merlijn van Deen

New submission from Merlijn van Deen:

Steps to reproduce:
---
>>> eval("u'ä'")
# in an utf-8 console, so this is equivalent to
>>> eval("u'\xc3\xa4'")

Actual result:

u'\xc3\xa4'
# i.e.: u'ä'

Expected result:
-
SyntaxError: Non-ASCII character '\xc3' in file  on line 1, but no 
encoding declared; see http://www.python.org/peps/pep-0263.html for details
(which is what would happen if it was in a source file)

Or, alternatively:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal 
not in range(128)
(which is what results from decoding the str with sys.getdefaultencoding())

Instead, the string is interpreted as latin-1. The same happens for 
ast.literal_eval - even calling compile() directly.

In python 3.2, this is the result, as utf-8 is used as default source encoding:
>>> eval(b"'\xc3\xa4'")
'ä'

Workarounds
--
>>> eval("# encoding: utf-8\nu'\xc3\xa4'")
u'\xe4'
>>> eval("u'\xc3\xa4'".decode('utf-8'))
u'\xe4'


I understand this might be considered a WONTFIX, as it would change behavior 
some people might depend on. Nonetheless, documenting this explicitly seems a 
sensible thing to do.

--
messages: 196398
nosy: valhallasw
priority: normal
severity: normal
status: open
title: eval() uses latin-1 to decode str
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



[issue18869] test suite: faulthandler signal handler is lost

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

> Or perhaps we could enhance the signal module so that getsignal() return 
> something (i.e. a specific object) which can restore the C signal handler. 
> That would be better than special-casing faulthandler, IMHO.

Yes, I thought about that, see http://bugs.python.org/msg146560
The only problem I saw at that time is that we must make sure that the
object is indeed valid, otherwise the signal handler can jump to an
invalid address, and boom.

--

___
Python tracker 

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



[issue18869] test suite: faulthandler signal handler is lost

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> > Or perhaps we could enhance the signal module so that getsignal() return 
> > something (i.e. a specific object) which can restore the C signal handler. 
> > That would be better than special-casing faulthandler, IMHO.
> 
> Yes, I thought about that, see http://bugs.python.org/msg146560
> The only problem I saw at that time is that we must make sure that the
> object is indeed valid, otherwise the signal handler can jump to an
> invalid address, and boom.

Well, to make sure the object is valid, you can just ensure instances
can't be created from Python (for example, make tp_new raise an error),
and that the internal state can't be mutated.

--

___
Python tracker 

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



[issue18643] implement socketpair() on Windows

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

Victor, did you have a chance to test the patch?

--

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Andrew Svetlov

Changes by Andrew Svetlov :


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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1c2a37459c70 by Andrew Svetlov in branch 'default':
Issue #11798: TestSuite now drops references to own tests after execution.
http://hg.python.org/cpython/rev/1c2a37459c70

--
nosy: +python-dev

___
Python tracker 

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



[issue16853] add a Selector to the select module

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

Alright, here's the patch, with all the changes discussed (and of
cours a separate selectors.py).

--
Added file: http://bugs.python.org/file31499/selectors-14.diff

___
Python tracker 

___diff -r df2fdd42b375 Doc/library/selectors.rst
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/Doc/library/selectors.rst Wed Aug 28 18:34:10 2013 +0200
@@ -0,0 +1,229 @@
+:mod:`selectors` -- High-level I/O multiplexing
+===
+
+.. module:: selectors
+   :synopsis: High-level I/O multiplexing.
+
+.. versionadded:: 3.4
+
+
+Introduction
+
+
+This module allows high-level and efficient I/O multiplexing, built upon the
+:mod:`select` module primitives. Users are encouraged to use this module
+instead, unless they want precise control over the OS-level primitives used.
+
+It defines a :class:`BaseSelector` abstract base class, along with several
+concrete implementations (:class:`KqueueSelector`, :class:`EpollSelector`...),
+that can be used to wait for I/O readiness notification on multiple file
+objects. In the following, "file object" refers to any object with a
+:meth:`fileno()` method, or a raw file descriptor. See :term:`file object`.
+
+:class:`DefaultSelector` is an alias to the most efficient implementation
+available on the current platform: this should be the default choice for most
+users.
+
+.. note::
+   The type of file objects supported depends on the platform: on Windows,
+   sockets are supported, but not pipes, whereas on Unix, both are supported
+   (some other types may be supported as well, such as fifos or special
+   devices).
+
+.. seealso::
+
+   :mod:`select`
+   Low-level I/O multiplexing module.
+
+
+Classes
+---
+
+Classes hierarchy::
+
+   BaseSelector
+   +-- SelectSelector
+   +-- PollSelector
+   +-- EpollSelector
+   +-- KqueueSelector
+
+
+In the following, *events* is a bitwise mask indicating which I/O events should
+be waited for on a given file object. It can be a combination of the constants
+below:
+
+   +---+---+
+   | Constant  | Meaning   |
+   +===+===+
+   | :const:`EVENT_READ`   | Available for read|
+   +---+---+
+   | :const:`EVENT_WRITE`  | Available for write   |
+   +---+---+
+
+
+.. class:: SelectorKey
+
+   A :class:`SelectorKey` is a :class:`~collections.namedtuple` used to
+   associate a file object to its underlying file decriptor, selected event
+   mask and attached data. It is returned by several :class:`BaseSelector`
+   methods.
+
+   .. attribute:: fileobj
+
+  File object registered.
+
+   .. attribute:: fd
+
+  Underlying file descriptor.
+
+   .. attribute:: events
+
+  Events that must be waited for this file object.
+
+   .. attribute:: data
+
+  Optional opaque data associated to this file object: for example, this
+  could be used to store per-client session.
+
+
+.. class:: BaseSelector
+
+   A :class:`BaseSelector` is used to wait for I/O event readiness on multiple
+   file objects. It supports file stream registration, unregistration, and a
+   method to wait for I/O events on those streams, with an optional timeout.
+   It's an abstract base class, so cannot be instanciated. Use
+   :class:`DefaultSelector` instead, or one of :class:`SelectSelector`,
+   :class:`KqueueSelector` etc. if you want to specifically use an
+   implementation, and your platform supports it.
+   :class:`BaseSelector` and its concrete implementations support the context
+   manager protocol.
+
+   .. method:: register(fileobj, events, data=None)
+
+  Register a file object for selection, monitoring it for I/O events.
+
+  *fileobj* is the file object to monitor
+  *events* is a bitwise mask of events to monitor
+  *data* is an opaque object
+
+  This returns a new :class:`SelectorKey` instance, or raises a
+  :exc:`ValueError` in case of invalid event mask or file descriptor, or
+  :exc:`KeyError` if the file object is already registered.
+
+   .. method:: unregister(fileobj)
+
+  Unregister a file object from selection, removing it from monitoring.
+
+  *fileobj* must be a file object previously registered.
+
+  This returns the associated :class:`SelectorKey` instance, or raises a
+  :exc:`KeyError` if the file object is not registered.
+
+   .. method:: modify(fileobj, events, data=None)
+
+  Change a registered file object monitored events or attached data.
+
+  This is equivalent to :meth:`BaseSelector.unregister(fileobj)` fol

[issue11798] Test cases not garbage collected after run

2013-08-28 Thread R. David Murray

R. David Murray added the comment:

This seems to be producing a test failure in test_doctest.  eg:

 
http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%203.x/builds/1920

--

___
Python tracker 

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



[issue18871] Be more stringent about the test suite

2013-08-28 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Here is a proposal to make the devguide more precise and explicit about needing 
to run the entire test suite before committing a change.

--
assignee: docs@python
components: Devguide, Documentation
files: test_suite.patch
keywords: patch
messages: 196405
nosy: asvetlov, docs@python, eric.araujo, ezio.melotti, ncoghlan, pitrou, 
r.david.murray
priority: normal
severity: normal
status: open
title: Be more stringent about the test suite
type: enhancement
versions: 3rd party
Added file: http://bugs.python.org/file31500/test_suite.patch

___
Python tracker 

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



[issue18702] Report skipped tests as skipped

2013-08-28 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread R. David Murray

R. David Murray added the comment:

I don't think it is even "won't fix".  Your "workarounds" are just the way you 
need to feed non-latin1 text into Python2.  Since the default source encoding 
in python2 is latin-1, and that is documented, I'm not sure what additional 
documentation you want?

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, r.david.murray

___
Python tracker 

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



[issue18869] test suite: faulthandler signal handler is lost

2013-08-28 Thread STINNER Victor

STINNER Victor added the comment:

"One way to fix this would be to add a WithSignalHandler(signal, handler) 
context manager to test.support that would replace the signal handler upon 
entry, and re-register faulthandler's handler upon exit."

faulthandler.dump_traceback_later() is registered before each test, in 
test.regrtest.runtest().

You may reinstall signal handlers before each test, or fix signal.getsignal() 
and signal.signal(). I don't have a preference.

--

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Matt McClure

Matt McClure added the comment:

This might fix it (untested):

diff -r d748d7020192 Lib/test/test_doctest.py
--- a/Lib/test/test_doctest.py  Sat Aug 03 10:09:25 2013 -0400
+++ b/Lib/test/test_doctest.py  Wed Aug 28 15:35:58 2013 -0400
@@ -2329,6 +2329,8 @@
 
 Now, when we run the test:
 
+  >>> suite = doctest.DocFileSuite('test_doctest.txt',
+  ...  optionflags=doctest.DONT_ACCEPT_BLANKLINE)
   >>> result = suite.run(unittest.TestResult())
   >>> print(result.failures[0][1]) # doctest: +ELLIPSIS
   Traceback ...

--

___
Python tracker 

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



[issue18871] Be more stringent about the test suite

2013-08-28 Thread R. David Murray

R. David Murray added the comment:

Looks OK to me.  Do we want to also recommend more explicitly that the tests be 
run with -uall?

--

___
Python tracker 

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



[issue18643] implement socketpair() on Windows

2013-08-28 Thread STINNER Victor

STINNER Victor added the comment:

> Victor, did you have a chance to test the patch?

I tested socketpair.diff (modified to use it even on Linux) on another 
computer, and test ran successfully.

On my main computer (Fedora 18, Linux kernel 3.9.4), the test is failing. With 
sendall_write.diff, the test does pass. test.support.PIPE_MAX_SIZE=4194305 (4 
MB) on this computer. I don't know for the other one.

--

___
Python tracker 

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



[issue17036] Implementation of the PEP 433: Easier suppression of file descriptor inheritance

2013-08-28 Thread STINNER Victor

STINNER Victor added the comment:

The PEP 433 was rejected, replaced with the PEP 446.

--
resolution:  -> rejected
status: open -> closed
superseder:  -> Implementation of the PEP 446: non-inheritable file descriptors

___
Python tracker 

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



[issue18871] Be more stringent about the test suite

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't know. I wouldn't insist too much on -uall, because generally it won't 
find anything more (except for network tests, perhaps).

--

___
Python tracker 

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



[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread STINNER Victor

STINNER Victor added the comment:

Where / how do you type the eval() instruction? In IDLE, in the interactive 
prompt (>>>) or in a script (test.py)? What is your OS and what is your locale 
encoding?

Example:

$ python -m platform
Linux-3.9.4-200.fc18.x86_64-x86_64-with-fedora-18-Spherical_Cow
$ python -c 'import locale; print(locale.getpreferredencoding())'
UTF-8

--
nosy: +haypo

___
Python tracker 

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



[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

$ python
Python 2.7.4 (default, Apr 19 2013, 18:28:01) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> eval("u'ä'")
u'\xc3\xa4'
>>> import locale
>>> locale.getpreferredencoding()
'UTF-8'

--

___
Python tracker 

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



[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Since the default source encoding in python2 is latin-1

Mmh, really? According to PEP 263:

Python will default to ASCII as standard encoding if no other
encoding hints are given.

And indeed when trying Merlijn's code in a .py file rather than an eval() call, 
I get:

SyntaxError: Non-ASCII character '\xc3' in file tcc.py on line 1, but no 
encoding declared; see http://www.python.org/peps/pep-0263.html for details

--
components: +Interpreter Core -Documentation
nosy: +benjamin.peterson, pitrou
type:  -> behavior

___
Python tracker 

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



[issue18851] subprocess's Popen closes stdout/stderr filedescriptors used in another thread when Popen errors

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, here is a fixed patch for Windows under 2.7.

--
Added file: http://bugs.python.org/file31501/subprocess_issue18851_2.patch

___
Python tracker 

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



[issue18869] test suite: faulthandler signal handler is lost

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

I'll tackle #13285 instead.

--
resolution:  -> duplicate
stage:  -> committed/rejected
superseder:  -> signal module ignores external signal changes

___
Python tracker 

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



[issue13285] signal module ignores external signal changes

2013-08-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +pitrou

___
Python tracker 

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



[issue18643] implement socketpair() on Windows

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

Since I'll update socket tests to also use support.PIPE_MAX_SIZE, maybe we 
should rename this variable while we're at it?
Anybody can think of a name that would work both for sockets and pipes?

--
nosy: +pitrou

___
Python tracker 

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



[issue18643] implement socketpair() on Windows

2013-08-28 Thread STINNER Victor

STINNER Victor added the comment:

"Since I'll update socket tests to also use support.PIPE_MAX_SIZE, maybe we 
should rename this variable while we're at it?"

Why not using a different value (constant) for sockets?

--

___
Python tracker 

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



[issue18872] platform.linux_distribution() doesn't recognize Amazon Linux

2013-08-28 Thread Lorin Hochstein

New submission from Lorin Hochstein:

Amazon EC2 has their own Fedora-like Linux distribution 
(http://aws.amazon.com/amazon-linux-ami/). This distribution isn't recognized 
by platform.linux_distribution():

>>> import platform
>>> platform.linux_distribution()
('', '', '')

$ cat /etc/issue
Amazon Linux AMI release 2013.03
Kernel \r on an \m

Tested on Python 2.6.8.

--
components: Library (Lib)
messages: 196420
nosy: Lorin.Hochstein
priority: normal
severity: normal
status: open
title: platform.linux_distribution() doesn't recognize Amazon Linux
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue18643] implement socketpair() on Windows

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

By alternating between PIPE and SOCK, you get POPK, which is as descriptive as 
it gets.

--

___
Python tracker 

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



[issue18851] subprocess's Popen closes stdout/stderr filedescriptors used in another thread when Popen errors

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch with test.

--
Added file: http://bugs.python.org/file31502/subprocess_issue18851_3.patch

___
Python tracker 

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



[issue18872] platform.linux_distribution() doesn't recognize Amazon Linux

2013-08-28 Thread Lorin Hochstein

Lorin Hochstein added the comment:

$ cat /etc/system-release
Amazon Linux AMI release 2013.03

--

___
Python tracker 

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



[issue18850] xml.etree.ElementTree accepts control chars.

2013-08-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue18643] implement socketpair() on Windows

2013-08-28 Thread Charles-François Natali

Charles-François Natali added the comment:

> Why not using a different value (constant) for sockets?

We can add a new constant (e.g. SOCK_MAX_SIZE), that would be fine, as
long as it aliases to PIPE_MAX_SIZE.
There's no need to have two values (the current 4MB value is fine).

> By alternating between PIPE and SOCK, you get POPK, which is as descriptive 
> as it gets.

Thank you Antoine :-)

I'll think I'll go for:
SOCK_MAX_SIZE = PIPE_MAX_SIZE = 4MB

--

___
Python tracker 

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



[issue7897] Support parametrized tests in unittest

2013-08-28 Thread Nick Coghlan

Nick Coghlan added the comment:

Right, subtests are about improving reporting without adding selectivity.
Explicitly parameterized tests require more structural changes to tests,
but give the selectivity that subtests don't.

--

___
Python tracker 

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



[issue18871] Be more stringent about the test suite

2013-08-28 Thread Nick Coghlan

Nick Coghlan added the comment:

Looks good to me. I think it's OK to leave the optional resources in the
set of things covered by the buildbots rather than expecting them to always
be run in pre-commit testing.

--

___
Python tracker 

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



[issue18871] Be more stringent about the test suite

2013-08-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a62bb0481ac9 by Antoine Pitrou in branch 'default':
Issue #18871: make it more explicit that the test suite should be run before 
committing
http://hg.python.org/devguide/rev/a62bb0481ac9

--
nosy: +python-dev

___
Python tracker 

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



[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread R. David Murray

R. David Murray added the comment:

Heh.  Obviously I've forgotten some things about python2.  I could have sworn 
the default was latin-1, but perhaps that was just the stdlib standard for 
coding cookies?  I don't use python2 much any more...

--

___
Python tracker 

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



[issue18871] Be more stringent about the test suite

2013-08-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks for allowing me to be lazy, Nick :-)

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



[issue18871] Be more stringent about the test suite

2013-08-28 Thread Nick Coghlan

Nick Coghlan added the comment:

The fact I don't run the tests with - uall before committing had nothing to
do with it whatsoever. Nope. Nothing at all ;)

--

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 17f23cf029cf by Andrew Svetlov in branch 'default':
Fix tests for #11798
http://hg.python.org/cpython/rev/17f23cf029cf

--

___
Python tracker 

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




[issue18870] eval() uses latin-1 to decode str

2013-08-28 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Yeah, this is an obnoxious bug. Too late to fix in Python 3, though. I would 
take a doc patch.

--
components: +Documentation -Interpreter Core

___
Python tracker 

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



[issue11798] Test cases not garbage collected after run

2013-08-28 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Sorry. Tests are fixed now.

--

___
Python tracker 

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



[issue15112] argparse: nargs='*' positional argument doesn't accept any items if preceded by an option and another positional

2013-08-28 Thread paul j3

paul j3 added the comment:

These three changes end up testing for the same thing. The initial 'if' catches 
different test cases.  'subparsers' or 'remainder' might 'confuse' the 'O' 
test.  The zero-width test ends up weeding out everything but the test cases 
added for this issue.

# if we haven't hit the end of the command line strings,
if start_index + sum(arg_counts) != len(arg_strings_pattern):
while arg_counts and arg_counts[-1] == 0: 
arg_counts.pop()

# same test using selected_pattern (= arg_strings_pattern[start_index:])
if len(selected_pattern) != sum(arg_counts):
while arg_counts and arg_counts[-1] == 0: 
arg_counts.pop()

# alt test: test for optional in the remaining pattern
if 'O' in selected_pattern:
while arg_counts and arg_counts[-1] == 0: 
arg_counts.pop()

--

___
Python tracker 

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



[issue18873] "Encoding" detected in non-comment lines

2013-08-28 Thread Paul Bonser

New submission from Paul Bonser:

lib2to3.pgen2.tokenize:detect_encoding looks for the regex 
"coding[:=]\s*([-\w.]+)" in the first two lines of the file without first 
checking if they are comment lines.

You can get 2to3 to fail with "SyntaxError: unknown encoding: 0" with a single 
line file:

coding=0

A simple fix would be to check that the line is a comment before trying to look 
up the encoding from that line.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 196435
nosy: Paul.Bonser
priority: normal
severity: normal
status: open
title: "Encoding" detected in non-comment lines
type: crash
versions: Python 2.7, Python 3.1, 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



  1   2   >