[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-12 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Thanks, Benjamin, for reviewing my patch.

Attached the fourth patch to wrap the "business" part inside the try ... 
finally.

--
Added file: 
http://bugs.python.org/file31237/formatter_fix_resource_warning_v4.patch

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-12 Thread Benjamin Peterson

Benjamin Peterson added the comment:

That will fail if fp is not assigned before an exception is raised. I mostly 
mean the part starting with the for loop.

--

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-12 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Ah, sorry about that.

Attached the fifth patch to only wrap "for loop" section inside the try... 
finally.

--
Added file: 
http://bugs.python.org/file31238/formatter_fix_resource_warning_v5.patch

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

About the implementation of sum: it's worth noting that the algorithm you're 
using for floats depends on correct rounding of addition and subtraction, and 
that that's not guaranteed.  See the existing test (testFsum) in test_math for 
more information, and note that that test is skipped on machines that don't do 
correct rounding.

This isn't an uncommon problem:  last time I looked, most 32-bit Linux systems 
had problems with double rounding, thanks to evaluating first to 64-bit 
precision using the x87 FPU, and then rounding to 53-bit precision as usual.  
(Python builds on 64-bit Linux tend to use the SSE2 instructions in preference 
to the x87, so don't suffer from this problem.)

Steven: any thoughts about how to deal with this?  Options are (1) just ignore 
the problem and hope no-one runs into it, (2) document it / warn about it, (3) 
try to fix it.  Fixing it would be reasonably easy for a C implementation (with 
access to the FPU control word, in the same way that our float<->string 
conversion already does), but not so easy in Python without switching algorithm 
altogether.

--

___
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-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Which one is the preferred way to go? "requires" or "test needs" or "needs"? 
> Or it does not matter?

I used the wording which used in other skips in the same file or in similar 
skips in other files. If it matters I will correct messages.

> Which one is the preferred way to go? With or without parentheses? Or it does 
> not matter?

Thank you for note. I will add missed parentheses to function names.

There are existing skip messages which uses function names without parentheses. 
I left them untouched (the patch already is a large enough).

--

___
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-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue17974.

--

___
Python tracker 

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



[issue16038] ftplib: unlimited readline() from connection

2013-08-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Error message "got more than %d bytes" is misleading because in most cases 
(except storlines()) we read not bytes but a text string.

There are 4 changes in the ftplib module but only one of them covered by test.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

>From the code:

# Also, like all dunder methods, we should call
# __float__ on the class, not the instance.

Why?  I've never encountered this recommendation before.  x.__float__() would 
be clearer, IMO.

--

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

> Why?  I've never encountered this recommendation before.  x.__float__() > 
> would be clearer, IMO.

Hmm;  it would be better if I engaged by brain before commenting.  I guess the 
point is that type(x).__float__(x) better matches the behaviour of the builtin 
float:


>>> class A:
... def __float__(self): return 42.0
... 
>>> a = A()
>>> a.__float__ = lambda: 1729.0
>>> 
>>> float(a)
42.0
>>> a.__float__()
1729.0
>>> type(a).__float__(a)
42.0


When you get around to tests, it would be nice to have a test for this 
behaviour, just so that someone who comes along and wonders the code is written 
this way gets an immediate test failure when they try to incorrectly "simplify" 
it.

--

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

(We don't seem to care too much about the distinction in general, though:  
there are a good few places in the std. lib. where obj.__index__() is used 
instead of the more correct type(obj).__index__(obj).)

--

___
Python tracker 

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



[issue3526] Customized malloc implementation on SunOS and AIX

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

PEP 445 allows you to customize the Python memory allocators, which is a better 
solution than shipping several ones with Python ;-)

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue18394] cgi.FieldStorage triggers ResourceWarning sometimes

2013-08-12 Thread Vajrasky Kok

Vajrasky Kok added the comment:

It happens because if the length of data is more than 1000:

def __write(self, line):
"""line is always bytes, not string"""
if self.__file is not None:
if self.__file.tell() + len(line) > 1000:
self.file = self.make_file()
data = self.__file.getvalue()
self.file.write(data)
self.__file = None
..

it will create a temporary file.

Attached the patch to close the temporary file in the destructor method.

About the 1000 number, should we put it in constant? Why 1000? This number is 
so random. For now, I just leave it as it is.

--
keywords: +patch
nosy: +vajrasky
Added file: 
http://bugs.python.org/file31239/fix_resource_warning_in_test_cgi.patch

___
Python tracker 

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



[issue18700] test_cgi raises ResourceWarning

2013-08-12 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Superseded by bug #18394.

Should we close this one by marking it as duplicate?

--
nosy: +vajrasky

___
Python tracker 

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



[issue12075] python3.2 memory leak when reloading class with attributes

2013-08-12 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
resolution: wont fix -> out of date

___
Python tracker 

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



[issue12075] python3.2 memory leak when reloading class with attributes

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Yes, __del__ will interfere with garbage collection before Python 3.4. This is 
pretty much expected (and is fixed in Python 3.4, but won't be backported).

--
nosy: +pitrou
resolution:  -> wont fix
stage:  -> committed/rejected
status: open -> closed
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



[issue1565525] tracebacks eat up memory by holding references to locals and globals when they are not wanted

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> We need maybe an helper to clear all frames referenced by a traceback?

Yes. Something in the traceback module would be fine.

--
components: +Library (Lib) -Interpreter Core
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread Christian Heimes

New submission from Christian Heimes:

Ryan Sleevi of the Google Chrome Security Team has informed us that Python's 
SSL module doesn't handle NULL bytes inside subjectAltNames general names. It's 
related to Ruby's CVE-2013-4073 
http://www.ruby-lang.org/en/news/2013/06/27/hostname-check-bypassing-vulnerability-in-openssl-client-cve-2013-4073/

Although Python uses a slightly different OpenSSL API to parse a X.509 
certificate and turn its fields into a dictionary, our implementation 
eventually uses an OpenSSL function that fails to handle NULL bytes. This could 
lead to a breach when an application uses ssl.match_hostname() to match the 
hostname againt the certificate's subjectAltName's dNSName general names.

When the Ruby issues was announced publicly I already suspected that our code 
may suffer from the same issue. But I was unable to generate a X.509 
certificate with a NULL byte in its X509v3 subjectAltName extension, only in 
subject and issuer. OpenSSL's config file format just didn't support NULL 
bytes. But Our code handled the NULL byte in subject in issuer just fine so I 
gave up. In the light of the bug report I went a different path and eventually 
I came up with a malicious certificate that showed the reported bug.

--
components: Extension Modules
messages: 194944
nosy: christian.heimes
priority: critical
severity: normal
stage: patch review
status: open
title: SSL module fails to handle NULL bytes inside subjectAltNames general 
names (CVE-2013-4073)
type: security
versions: Python 2.6, 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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread Christian Heimes

Changes by Christian Heimes :


Added file: http://bugs.python.org/file31242/CVE-2013-4073_py33.patch

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread Christian Heimes

Changes by Christian Heimes :


--
keywords: +patch
Added file: http://bugs.python.org/file31241/CVE-2013-4073_py34.patch

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread Christian Heimes

Changes by Christian Heimes :


Added file: http://bugs.python.org/file31243/CVE-2013-4073_py27.patch

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread Christian Heimes

Christian Heimes added the comment:

Demo certificate:

Certificate:
Data:
Version: 3 (0x2)
Serial Number: 0 (0x0)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, 
OU=Python Core Development, 
CN=null.python.org\x00example.org/emailAddress=python-...@python.org
Validity
Not Before: Aug  7 13:11:52 2013 GMT
Not After : Aug  7 13:12:52 2013 GMT
Subject: C=US, ST=Oregon, L=Beaverton, O=Python Software Foundation, 
OU=Python Core Development, 
CN=null.python.org\x00example.org/emailAddress=python-...@python.org
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
Modulus:
00:b5:ea:ed:c9:fb:46:7d:6f:3b:76:80:dd:3a:f3:
03:94:0b:a7:a6:db:ec:1d:df:ff:23:74:08:9d:97:
16:3f:a3:a4:7b:3e:1b:0e:96:59:25:03:a7:26:e2:
88:a9:cf:79:cd:f7:04:56:b0:ab:79:32:6e:59:c1:
32:30:54:eb:58:a8:cb:91:f0:42:a5:64:27:cb:d4:
56:31:88:52:ad:cf:bd:7f:f0:06:64:1f:cc:27:b8:
a3:8b:8c:f3:d8:29:1f:25:0b:f5:46:06:1b:ca:02:
45:ad:7b:76:0a:9c:bf:bb:b9:ae:0d:16:ab:60:75:
ae:06:3e:9c:7c:31:dc:92:2f:29:1a:e0:4b:0c:91:
90:6c:e9:37:c5:90:d7:2a:d7:97:15:a3:80:8f:5d:
7b:49:8f:54:30:d4:97:2c:1c:5b:37:b5:ab:69:30:
68:43:d3:33:78:4b:02:60:f5:3c:44:80:a1:8f:e7:
f0:0f:d1:5e:87:9e:46:cf:62:fc:f9:bf:0c:65:12:
f1:93:c8:35:79:3f:c8:ec:ec:47:f5:ef:be:44:d5:
ae:82:1e:2d:9a:9f:98:5a:67:65:e1:74:70:7c:cb:
d3:c2:ce:0e:45:49:27:dc:e3:2d:d4:fb:48:0e:2f:
9e:77:b8:14:46:c0:c4:36:ca:02:ae:6a:91:8c:da:
2f:85
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints: critical
CA:FALSE
X509v3 Subject Key Identifier:
88:5A:55:C0:52:FF:61:CD:52:A3:35:0F:EA:5A:9C:24:38:22:F7:5C
X509v3 Key Usage:
Digital Signature, Non Repudiation, Key Encipherment
X509v3 Subject Alternative Name:
*
WARNING: The values for DNS, email and URI are WRONG. OpenSSL
 doesn't print the text after a NULL byte.
*
DNS:altnull.python.org, email:n...@python.org, 
URI:http://null.python.org, IP Address:192.0.2.1, IP 
Address:2001:DB8:0:0:0:0:0:1
Signature Algorithm: sha1WithRSAEncryption
 ac:4f:45:ef:7d:49:a8:21:70:8e:88:59:3e:d4:36:42:70:f5:
 a3:bd:8b:d7:a8:d0:58:f6:31:4a:b1:a4:a6:dd:6f:d9:e8:44:
 3c:b6:0a:71:d6:7f:b1:08:61:9d:60:ce:75:cf:77:0c:d2:37:
 86:02:8d:5e:5d:f9:0f:71:b4:16:a8:c1:3d:23:1c:f1:11:b3:
 56:6e:ca:d0:8d:34:94:e6:87:2a:99:f2:ae:ae:cc:c2:e8:86:
 de:08:a8:7f:c5:05:fa:6f:81:a7:82:e6:d0:53:9d:34:f4:ac:
 3e:40:fe:89:57:7a:29:a4:91:7e:0b:c6:51:31:e5:10:2f:a4:
 60:76:cd:95:51:1a:be:8b:a1:b0:fd:ad:52:bd:d7:1b:87:60:
 d2:31:c7:17:c4:18:4f:2d:08:25:a3:a7:4f:b7:92:ca:e2:f5:
 25:f1:54:75:81:9d:b3:3d:61:a2:f7:da:ed:e1:c6:6f:2c:60:
 1f:d8:6f:c5:92:05:ab:c9:09:62:49:a9:14:ad:55:11:cc:d6:
 4a:19:94:99:97:37:1d:81:5f:8b:cf:a3:a8:96:44:51:08:3d:
 0b:05:65:12:eb:b6:70:80:88:48:72:4f:c6:c2:da:cf:cd:8e:
 5b:ba:97:2f:60:b4:96:56:49:5e:3a:43:76:63:04:be:2a:f6:
 c1:ca:a9:94

The correct values are:

(('DNS', 'altnull.python.org\x00example.com'),
 ('email', 'n...@python.org\x00u...@example.org'),
 ('URI', 'http://null.python.org\x00http://example.org'),
 ('IP Address', '192.0.2.1'),
 ('IP Address', '2001:DB8:0:0:0:0:0:1\n'))

--
Added file: http://bugs.python.org/file31240/nullbytecert.pem

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-12 Thread Martijn Pieters

Martijn Pieters added the comment:

> The formatter module was deprecated? When?

It wasn't, that's the point I am raising. The `formatter` module was 
exclusively used by the `htmllib` module, I am surprised the `formatter` module 
wasn't part of that deprecation.

--

___
Python tracker 

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



[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-12 Thread R. David Murray

R. David Murray added the comment:

Pydoc uses DumbWriter.

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



[issue16396] Importing ctypes.wintypes on Linux gives a traceback

2013-08-12 Thread Ezio Melotti

Ezio Melotti added the comment:

Even if the patch is applied only on 3.4, I would still like to see the 
ValueError turned into ImportError for 2.7/3.3.

--

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Attached patch adds PyState_GetModuleAttr() and converts the _csv module to use 
it (as an example).

As you can see, the _csv module grows a little but it now has proper error 
handling (previously, it didn't check for PyState_FindModule() returning NULL).

(A few lines would be removed if we added PyErr_FormatV as well...)

--
components: Extension Modules, Interpreter Core
files: getmodattr.patch
keywords: patch
messages: 194949
nosy: eli.bendersky, loewis, ncoghlan, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Add PyState_GetModuleAttr
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31244/getmodattr.patch

___
Python tracker 

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



[issue17997] ssl.match_hostname(): sub string wildcard should not match IDNA prefix

2013-08-12 Thread Christian Heimes

Christian Heimes added the comment:

Ryan Sleevi of the Google Chrome Security Team has informed us about another 
issue that is caused by our failure to implement RFC 6125 wildcard matching 
rules. RFC 6125 allows only one wildcard in the left-most fragment of a 
hostname. For security reasons matching rules like *.*.com should be not 
supported.

For wildcards in internationalized domain names I have followed the 
piece of advice "In the face of ambiguity, refuse the temptation to guess.". A 
substring wildcard does no longer match an IDN A-label fragment. '*' still 
matches a full punycode fragment but 'x*' no longer matches 'xn--foo'. I copied 
the idea from Chrome's matching code:

http://src.chromium.org/viewvc/chrome/trunk/src/net/cert/x509_certificate.cc?revision=212341#l640

// * must not match a substring of an IDN A label; just a whole 
fragment.
if (reference_host.starts_with("xn--") &&
!(pattern_begin.empty() && pattern_end.empty()))
continue;

The relevant RFC section for the patch are

  http://tools.ietf.org/html/rfc6125#section-6.4.3
  http://tools.ietf.org/html/rfc2818#section-3.1
  http://tools.ietf.org/html/rfc2459#section-4.2.1.7
  http://tools.ietf.org/html/rfc5280#section-7

--
keywords: +patch
stage: needs patch -> patch review
versions: +Python 3.2
Added file: http://bugs.python.org/file31245/match_hostname_RFC6125.patch

___
Python tracker 

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



[issue18693] help() not helpful with enum

2013-08-12 Thread Eli Bendersky

Eli Bendersky added the comment:

Ethan, please revert your commit first. I liked the previous dir. The current 
one is useless.

I think you may be right about help, but I didn't dig deep enough to be sure.

--

___
Python tracker 

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



[issue18711] Add PyErr_FormatV

2013-08-12 Thread Antoine Pitrou

New submission from Antoine Pitrou:

PyErr_FormatV can be useful to write third-party helper functions. Patch 
attached.

--
components: Interpreter Core
files: pyerr_formatv.patch
keywords: patch
messages: 194952
nosy: pitrou
priority: low
severity: normal
stage: patch review
status: open
title: Add PyErr_FormatV
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31246/pyerr_formatv.patch

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand your change. Why do we need to change the _csv module and 
why storing module global variables in the module dict is better than storing 
them in a simple C structure?

--
nosy: +haypo

___
Python tracker 

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



[issue18693] help() not helpful with enum

2013-08-12 Thread Ronald Oussoren

Changes by Ronald Oussoren :


--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> I don't understand your change. Why do we need to change the _csv
> module and why storing module global variables in the module dict is
> better than storing them in a simple C structure?

I won't repeat what was already said in the python-dev thread:
http://mail.python.org/pipermail/python-dev/2013-August/127862.html

--

___
Python tracker 

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



[issue18711] Add PyErr_FormatV

2013-08-12 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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Christian Heimes

Christian Heimes added the comment:

The patch contains the new function and a patch for the CSV module. How about 
you split it up across two patches: one for the new feature and one for the CSV 
module? It makes review easier.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Bundling the two was aimed at showcasing the effect the new function can have. 
The function itself is trivial, there's not much point in reviewing it alone.

--

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread STINNER Victor

STINNER Victor added the comment:

+PyObject *
+PyState_GetModuleAttr(struct PyModuleDef *def,
+  const char *name,
+  PyObject *restrict_type)

When the char* type is used, the function has usually the suffix String. I 
prefer the PyIdentifier API because it avoids to create a temporary Python 
Unicode object.

It's the first type that I see a function getting an attribute which also 
checks for its type. I don't know if the check should be done in 
PyState_GetModuleAttr() or in the _csv module.

--

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread STINNER Victor

STINNER Victor added the comment:

Does it really make sense to allow to open a certificate containing a NUL byte 
in its name? How does OpenSSL and other projects handle this case?

--
nosy: +haypo

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4073)

2013-08-12 Thread Christian Heimes

Christian Heimes added the comment:

OpenSSL's print() functions fail to handle the NULL byte in subjectAltName 
(SAN) general names as they use strlen() or printf() functions with "%s" format 
char. The subject and issuer elements with NULL bytes are handled correctly by 
OpenSSL.

wget and curl combine CN / SAN parsing and hostname matching in one function. 
Both report an error when they see a NULL byte in a dNSName (strlen(dNSName) != 
lengtt of ASN1_STRING).

Python has separate functions for retrieving the X.509 information and matching 
a hostname against CN / SAN. I like to keep it that way and just for our 
parsing code in this bug. Latter ssl.match_hostname() can check for NULL bytes 
and raise an exception, but that's a different issue.

--

___
Python tracker 

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



[issue17997] ssl.match_hostname(): sub string wildcard should not match IDNA prefix

2013-08-12 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> When the char* type is used, the function has usually the suffix
> String. I prefer the PyIdentifier API because it avoids to create a
> temporary Python Unicode object.

This is a convenience API, not a performance "optimization".

> It's the first type that I see a function getting an attribute which
> also checks for its type. I don't know if the check should be done
> in PyState_GetModuleAttr() or in the _csv module.

The aim is to help writing extension modules, which is why the type
check is done inside the helper function.

--

___
Python tracker 

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



[issue18693] help() not helpful with enum

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 39697dcd97e3 by Ethan Furman in branch 'default':
Issue 18693: Put custom __dir__ back in place.  Will instead look at fixing 
`help()`.
http://hg.python.org/cpython/rev/39697dcd97e3

--

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Eli Bendersky

Eli Bendersky added the comment:

The patched code looks better than the original one in several respects, but I 
think it raises some questions.

I agree with Victor that the type-checking API is unnatural, but I also think 
there may be a deeper issue hiding behind. You felt compelled to add the 
type-checking to provide some level of safety to the C code - but is it enough? 
Previously, the only way to add a dialect was through register_dialect that 
does type checking to make sure it gets a legit dialect object. Now, the 
_dialects dict is directly accessible to Python code and it can add arbitrary 
objects to it (both as keys and as values). Does this mean that the C code now 
has to do type checking in all internal code that accesses _dialects? I haven't 
had time to find a crasher example, but it's plausible that it's possible to 
crash the interpreter now by assigning un-expected stuff to members of 
_dialects.

Maybe it's not a problem in practice for _csv but something worth thinking 
about if we're going to switch other methods to this approach.

Also, the problem with 
http://mail.python.org/pipermail/python-dev/2013-August/127862.html does not go 
away with this patch, as expected. However, it's a step in the right direction 
in case we do have multiple instances of the extension module alive at the same 
time in the future. Although then it would be interesting to consider how to 
find the actually correct module instance from internal functions.

--

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Previously, the only way to add a dialect was through register_dialect that 
> does
> type checking to make sure it gets a legit dialect object. Now, the _dialects 
> dict is 
> directly accessible to Python code and it can add arbitrary objects to it 
> (both as
> keys and as values). Does this mean that the C code now has to do type 
> checking in all 
> internal code that accesses _dialects?

You are right, I forgot about that part. That will make the patch significantly 
more complicated.

> However, it's a step in the right direction in case we do have multiple 
> instances of
> the extension module alive at the same time in the future. Although then it 
> would be
> interesting to consider how to find the actually correct module instance from 
> internal 
> functions.

This sounds basically impossible (which is why we *can't* have multiple 
instances of an extension module alive in a single interpreter :-)).

--

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-12 Thread Mark Dickinson

New submission from Mark Dickinson:

Nitpick: the pure Python version of operator.index (new in Python 3.4, 
introduced in issue #16694) doesn't match the C version, in that it looks up 
__index__ on the object rather than the class.


iwasawa:cpython mdickinson$ ./python.exe
Python 3.4.0a1+ (default:9e61563edb67+, Aug 12 2013, 14:45:12) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from test import support
>>> py_operator = support.import_fresh_module('operator', blocked=['_operator'])
>>> c_operator = support.import_fresh_module('operator', fresh=['_operator'])
>>> class A(int): pass
... 
>>> a = A(42); a.__index__ = lambda: 1729
>>> 
>>> py_operator.index(a)
1729
>>> c_operator.index(a)
42

--
components: Extension Modules
messages: 194966
nosy: mark.dickinson, zach.ware
priority: normal
severity: normal
status: open
title: Pure Python operator.index doesn't match the C version.
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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Breaking the 1:1 interpreter <-> extension module mapping involves
adding custom types to sys.modules rather than module objects. Making
that work sensibly will involve larger changes to the extension
initialisation APIs. import-sig already has plans for this :)

--

___
Python tracker 

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



[issue18710] Add PyState_GetModuleAttr

2013-08-12 Thread Eli Bendersky

Eli Bendersky added the comment:

> Previously, the only way to add a dialect was through register_dialect
that does

>  > type checking to make sure it gets a legit dialect object. Now, the
> _dialects dict is
> > directly accessible to Python code and it can add arbitrary objects to
> it (both as
> > keys and as values). Does this mean that the C code now has to do type
> checking in all
> > internal code that accesses _dialects?
>
> You are right, I forgot about that part. That will make the patch
> significantly more complicated.
>

:-/

Turns out there's real merit in having a clear dividing line between the
safe world of Python and unsafe world of C. Within the C code, some
invariants are assumed to be correct (and can be efficiently assert()-ed) -
this makes the code simpler and more performant.

> > However, it's a step in the right direction in case we do have multiple
> instances of
> > the extension module alive at the same time in the future. Although then
> it would be
> > interesting to consider how to find the actually correct module instance
> from internal
> > functions.
>
> This sounds basically impossible (which is why we *can't* have multiple
> instances of an extension module alive in a single interpreter :-)).
>

Well, it surely isn't possible without significant code rewriting. But I
can envision carrying such "state" around in extension-specific objects.
Although it's not entirely clear whether the memory cost is justified.

But without it, it's not clear to me how we plan to have multiple living
extension modules at all. Perhaps this is a discussion outside this
specific issue though (maybe for the PEP Stefan writes)

--

___
Python tracker 

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



[issue18660] os.read behavior on Linux

2013-08-12 Thread Louis Riviere

Louis Riviere added the comment:

Thanks Benjamin !
I should have known that "Python doesn't break things" :)

--

___
Python tracker 

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-12 Thread Nick Coghlan

New submission from Nick Coghlan:

One problem with Unicode in 3.x is that surrogateescape isn't normally enabled 
on stdin and stdout. This means the following code will fail with 
UnicodeEncodeError in the presence of invalid filesystem metadata:

print(os.listdir())

We don't really want to enable surrogateescape on sys.stdin or sys.stdout 
unilaterally, as it increases the chance of data corruption errors when the 
filesystem encoding and the IO encodings don't match.

Last night, Toshio and I thought of a possible solution: enable surrogateescape 
by default for sys.stdin and sys.stdout on non-Windows systems if (and only if) 
they're using the same codec as that returned by sys.getfilesystemencoding() 
(allowing for codec aliases rather than doing a simple string comparison)

This means that for full UTF-8 systems (which includes most modern Linux 
installations), roundtripping will be enabled by default between the standard 
streams and OS facing APIs, while systems where the encodings don't match will 
still fail noisily.

A more general alternative is also possible: default to errors='surrogatescape' 
for *any* text stream that uses the filesystem encoding. It's primarily the 
standard streams we're interested in fixing, though.

--
messages: 194968
nosy: abadger1999, benjamin.peterson, ezio.melotti, haypo, lemburg, ncoghlan, 
pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Enable surrogateescape on stdin and stdout when appropriate
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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-12 Thread R. David Murray

R. David Murray added the comment:

My gut reaction to this is that it feels dangerous.  That doesn't mean my gut 
is right, I'm just reporting my reaction :)

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



[issue18713] Enable surrogateescape on stdin and stdout when appropriate

2013-08-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Everything about surrogateescape is dangerous - we're trying to work
around the presence of bad data by at least allowing it to be
tunnelled through Python code without corrupting it further :)

--

___
Python tracker 

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



[issue18367] See if a venv setup can be used for devinabox for coverage

2013-08-12 Thread Brett Cannon

Changes by Brett Cannon :


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



[issue18451] Omit test files in devinabox coverage run

2013-08-12 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue18689] add argument for formatter to logging.Handler and subclasses in logging module

2013-08-12 Thread Derek Wilson

Derek Wilson added the comment:

dictConfig and fileConfig are nice for static needs, but when I want to quickly 
enable a complex (but not complicated) logging flow I find it just as tedious 
as the current situation with the direct API.

> ... as at the very least every handler would need to be changed to 
> accommodate the new kwarg

Adding a keyword only argument to the base handler and the other handler 
classes is a nearly trivial change in terms of lines and complexity of the code.

> Also, this isn't going to work for third-party handlers which are out there 
> already, since they won't necessarily recognise a new kwarg.

I don't see that as a problem. If 3rd party handlers are intelligent then they 
will include **kargs in their __init__ and pass that forward to the 
initialization of their parent. If they haven't done so then nothing changes 
for them and they just support exactly the same features they supported 
previously.

--
status: pending -> open

___
Python tracker 

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



[issue18578] Rename and document test.bytecode_helper as test.support.bytecode_helper

2013-08-12 Thread Seydou Dia

Seydou Dia added the comment:

I have a hard time figuring out what exactly BytecodeTestCase methods actually 
do. Thus the documentation is not probably accurate.

--
keywords: +patch
Added file: http://bugs.python.org/file31247/issue-18578.diff

___
Python tracker 

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



[issue18598] Importlib, more verbosity please

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2294594fbe6c by Brett Cannon in branch 'default':
Closes issue #18598: Have the exception message for
http://hg.python.org/cpython/rev/2294594fbe6c

--
nosy: +python-dev

___
Python tracker 

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



[issue18598] Importlib, more verbosity please

2013-08-12 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> fixed
stage: needs patch -> 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



[issue12837] Patch for issue #12810 removed a valid check on socket ancillary data

2013-08-12 Thread Brett Cannon

Brett Cannon added the comment:

This is still a warning and so I'm still looking for a solution.

--

___
Python tracker 

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



[issue18667] missing HAVE_FCHOWNAT

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a89226508a04 by Larry Hastings in branch '3.3':
Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions.
http://hg.python.org/cpython/rev/a89226508a04

--
nosy: +python-dev

___
Python tracker 

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



[issue18667] missing HAVE_FCHOWNAT

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 92de1a5dc3ea by Larry Hastings in branch 'default':
Issue #18667: Add missing "HAVE_FCHOWNAT" symbol to posix._have_functions.
http://hg.python.org/cpython/rev/92de1a5dc3ea

--

___
Python tracker 

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



[issue18667] missing HAVE_FCHOWNAT

2013-08-12 Thread Larry Hastings

Larry Hastings added the comment:

Fixed in 3.3 and trunk.  Thanks for the report!

--
assignee:  -> larry
resolution:  -> fixed
stage:  -> 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



[issue18416] Move to absolute file paths for module.__file__

2013-08-12 Thread Madison May

Madison May added the comment:

Here's a minor revision to that patch removing an unnecessary 
@skip_if_dont_write_bytecode decorator from the test I added to test_import.py. 
 

No docs changes are included in the current patch -- I'm guessing this should 
probably wait until we have all the other details ironed out.

--

___
Python tracker 

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



[issue18416] Move to absolute file paths for module.__file__

2013-08-12 Thread Madison May

Changes by Madison May :


Added file: http://bugs.python.org/file31248/Issue18416_v2.patch

___
Python tracker 

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



[issue18700] test_cgi raises ResourceWarning

2013-08-12 Thread Madison May

Madison May added the comment:

Good catch, Vajrasky.  I'll close the issue and add my brief report to bug 
#18394.

--
status: open -> closed

___
Python tracker 

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



[issue18394] cgi.FieldStorage triggers ResourceWarning sometimes

2013-08-12 Thread Madison May

Madison May added the comment:

I ran into a similar issue (see #18700) with test_cgi.

``/home/mmay/cpython/Lib/test/test_cgi.py:276: ResourceWarning: unclosed file 
<_io.BufferedRandom name=3>``

--
nosy: +madison.may

___
Python tracker 

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



[issue1666318] shutil.copytree doesn't give control over directory permissions

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hey Catherine,
Do you want to update your patch to include Vajrasky's suggestion?

--

___
Python tracker 

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



[issue18694] getxattr on Linux ZFS native filesystem happily returns partial values

2013-08-12 Thread Larry Hastings

Larry Hastings added the comment:

Attached is an updated patch, this time for 3.3.  (So I'm guessing we won't get 
a "review" link.)  It incorporates Benjamin's two comments.

--
Added file: http://bugs.python.org/file31249/larry.setxattr.zfs.3.3.patch.1.txt

___
Python tracker 

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



[issue18694] getxattr on Linux ZFS native filesystem happily returns partial values

2013-08-12 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Okay. Hopefully, we can kill that thing one day...

--

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On 09/08/13 21:49, Oscar Benjamin wrote:

> I think that the argument `m` to variance, pvariance, stdev and pstdev
> should be renamed to `mu` for pvariance/pstdev and `xbar` for
> variance/stdev. The doc-strings should carefully distinguish that `mu`
> is the true/population mean and `xbar` is the estimated/sample mean
> and refer to this difference between the function variants.

Good thinking, and I agree.

--

___
Python tracker 

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



[issue16396] Importing ctypes.wintypes on Linux gives a traceback

2013-08-12 Thread Jason R. Coombs

Jason R. Coombs added the comment:

My sense on the issue is that wintypes was added to the library and was never 
intended to raise a ValueError on import. By that logic, the behavior is a bug, 
not a new feature. I agree with Ezio that raising a ValueError on import is a 
bug. And since the patch not only addresses the ValueError on import, but 
simply addresses the underlying cause, it seems to me the most obvious solution.

--

___
Python tracker 

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



[issue18714] Add tests for pdb.find_function

2013-08-12 Thread Kevin Jing Qiu

New submission from Kevin Jing Qiu:

PyConCA 2013 sprint task

--
components: Tests
messages: 194986
nosy: Kevin.Jing.Qiu
priority: normal
severity: normal
status: open
title: Add tests for pdb.find_function
type: enhancement
versions: Python 3.5

___
Python tracker 

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



[issue18714] Add tests for pdb.find_function

2013-08-12 Thread Kevin Jing Qiu

Changes by Kevin Jing Qiu :


--
keywords: +patch
Added file: http://bugs.python.org/file31251/mywork.patch

___
Python tracker 

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



[issue18715] Tests fail when run with coverage

2013-08-12 Thread Seydou Dia

New submission from Seydou Dia:

When I run the tests suit with coverage (e.g, ./python COVERAGEDIR run --pylib 
Lib/test/regrtest.py test_frame), the following tests fails:

 * test_frame
 * test_xml_etree
 * test_threading_local
 * test_super
 * test_importlib

 The tracebacks are available here : http://pastebin.com/j6ScCibV

--
components: Tests
messages: 194988
nosy: seydou
priority: normal
severity: normal
status: open
title: Tests fail when run with coverage
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



[issue18585] Add a text truncation function

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch renaming summarize() to shorten(), and adding docs and a fix for 
a nit reported by Vajrasky.

--
Added file: http://bugs.python.org/file31250/shorten.patch

___
Python tracker 

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



[issue18716] Deprecate the formatter module

2013-08-12 Thread Brett Cannon

New submission from Brett Cannon:

Turns out the formatter module isn't really used by anyone. Pydoc uses it, but 
it could easily use textwrap. Searching on Github shows a usage by someone who 
simply re-exposes it as part of their own public API but has no actual usage 
themselves 
(https://github.com/search?q=%22import+formatter%22&ref=searchresults&type=Code 
and 
https://github.com/search?q=%22from+formatter%22&type=Code&ref=searchresults) . 
A Google search only turns up references in books 
(https://www.google.ca/search?{google:acceptedSuggestion}oq=%22import+formatter%22&{google:instantFieldTrialGroupParameter}sourceid=chrome&ie=UTF-8&q=%22import+formatter%22&qscrl=1#bav=on.2,or.r_cp.r_qf.&fp=7bfd11bde90d01cb&q=%22import+formatter%22+OR+%22from+formatter%22&qscrl=1).

The attached patch deprecated formatter for removal in Python 3.6.

--
components: Library (Lib)
files: deprecate_formatter.diff
keywords: patch
messages: 194989
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Deprecate the formatter module
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file31252/deprecate_formatter.diff

___
Python tracker 

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



[issue18707] the readme should also talk about how to build doc.

2013-08-12 Thread Éric Araujo

Éric Araujo added the comment:

There is a README in the Doc directory.  Wouldn’t it be enough to point to that 
file from the main README?

--

___
Python tracker 

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



[issue18694] getxattr on Linux ZFS native filesystem happily returns partial values

2013-08-12 Thread Larry Hastings

Larry Hastings added the comment:

Kill what thing?  The review link?  I love that thing?

Anyway, we did get a review link, hoopla!

--

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On 12/08/13 19:21, Mark Dickinson wrote:

> About the implementation of sum: it's worth noting that the algorithm you're 
> using for floats depends on correct rounding of addition and subtraction, and 
> that that's not guaranteed.
[...]
> Steven: any thoughts about how to deal with this?  Options are (1) just 
> ignore the problem and hope no-one runs into it, (2) document it / warn about 
> it, (3) try to fix it.  Fixing it would be reasonably easy for a C 
> implementation (with access to the FPU control word, in the same way that our 
> float<->string conversion already does), but not so easy in Python without 
> switching algorithm altogether.

Document it and hope :-)

add_partial is no longer documented as a public function, so I'm open to 
switching algorithms in the future.

--

___
Python tracker 

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



[issue18716] Deprecate the formatter module

2013-08-12 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

Okay, that works.  I agree that not documenting add_partial is probably a good 
plan.

--

___
Python tracker 

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



[issue18689] add argument for formatter to logging.Handler and subclasses in logging module

2013-08-12 Thread Vinay Sajip

Vinay Sajip added the comment:

> If 3rd party handlers are intelligent

It's not an ideal world. Sorry, but I think this change is too invasive to 
consider. I can't believe this change is really needed - logging has been 
around since 2002 and this has never been raised before.

--
status: open -> closed

___
Python tracker 

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



[issue18716] Deprecate the formatter module

2013-08-12 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue18716] Deprecate the formatter module

2013-08-12 Thread Larry Hastings

Larry Hastings added the comment:

+1

--
nosy: +larry

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

New submission from Muhammad Jehanzeb:

As part of pyconca sprints, this is my first patch for urlcleanup test

--
components: Tests
files: test_urllib.py
messages: 194996
nosy: mjehanzeb
priority: normal
severity: normal
status: open
title: test for request.urlretrieve
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31253/test_urllib.py

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Ezio Melotti

Ezio Melotti added the comment:

Thanks for your contribution.  Can you submit this as a diff?

--
nosy: +ezio.melotti
stage:  -> patch review

___
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-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a preliminary patch which get rids of _convert_namespace_to_getopt() 
and directly uses a Namespace object. Unfortunately it breaks tests because 
test_regrtest depends on implementation details of the regrtest module and uses 
_convert_namespace_to_getopt(). If the proposed patch is good enough I will try 
to write suitable tests.

--
Added file: http://bugs.python.org/file31254/regrtest_argparse.patch

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

We can use type(a).__index__(a). Should we also correct the documentation for 
operator.index() and operator.length_hint()?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Muhammad Jehanzeb added the comment:

the patch fie

--
keywords: +patch
Added file: http://bugs.python.org/file31255/mywork.patch

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Changes by Muhammad Jehanzeb :


Removed file: http://bugs.python.org/file31253/test_urllib.py

___
Python tracker 

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



[issue17701] Improving strftime documentation

2013-08-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset adbc9789a5e4 by David Wolever in branch '2.7':
Issue #17701: Improving strftime documentation
http://hg.python.org/cpython/rev/adbc9789a5e4

--
nosy: +python-dev

___
Python tracker 

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



[issue18707] the readme should also talk about how to build doc.

2013-08-12 Thread Ezio Melotti

Ezio Melotti added the comment:

+1

--
type:  -> enhancement
versions: +Python 2.7, Python 3.3

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Changes by Muhammad Jehanzeb :


Removed file: http://bugs.python.org/file31255/mywork.patch

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Muhammad Jehanzeb added the comment:

included issue# in the patch file

--
Added file: http://bugs.python.org/file31256/issue18717.patch

___
Python tracker 

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



[issue18717] test for request.urlretrieve

2013-08-12 Thread Muhammad Jehanzeb

Changes by Muhammad Jehanzeb :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue18606] Add statistics module to standard library

2013-08-12 Thread Oscar Benjamin

Oscar Benjamin added the comment:

On 12 August 2013 20:20, Steven D'Aprano  wrote:
> On 12/08/13 19:21, Mark Dickinson wrote:
>> About the implementation of sum:
> add_partial is no longer documented as a public function, so I'm open to 
> switching algorithms in the future.

Along similar lines it might be good to remove the doc-test for using
decimal.ROUND_DOWN. I can't see any good reason for anyone to want
that behaviour when e.g. computing the mean() whereas I can see
reasons for wanting to reduce rounding error for decimal in
statistics.sum. It might be a good idea not to tie yourself to the
guarantee implied by that test.

I tried an alternative implementation of sum() that can also reduce
rounding error with decimals but it failed that test (by making the
result more accurate). Here's the sum() I wrote:

def sum(data, start=0):

if not isinstance(start, numbers.Number):
raise TypeError('sum only accepts numbers')

inexact_types = (float, complex, decimal.Decimal)
def isexact(num):
return not isinstance(num, inexact_types)

if isexact(start):
exact_total, inexact_total = start, 0
else:
exact_total, inexact_total = 0, start

carrybits = 0

for x in data:
if isexact(x):
exact_total = exact_total + x
else:
new_inexact_total = inexact_total + (x + carrybits)
carrybits = -(((new_inexact_total - inexact_total) - x) - carrybits)
inexact_total = new_inexact_total

return (exact_total + inexact_total) + carrybits

It is more accurate for e.g. the following:
nums = [decimal.Decimal(10 ** n) for n in range(50)]
nums += [-n for n in reversed(nums)]
assert sum(nums) == 0

However there will also be other situations where it is less accurate such as
print(sum([-1e30, +1e60, 1, 3, -1e60, 1e30]))
so it may not be suitable as-is.

--

___
Python tracker 

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



[issue18699] What is Future.running() for in PEP 3148 / concurrent.futures.Future?

2013-08-12 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue18585] Add a text truncation function

2013-08-12 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Updated patch addressing Ezio's comments.

--
Added file: http://bugs.python.org/file31257/shorten2.patch

___
Python tracker 

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



[issue18712] Pure Python operator.index doesn't match the C version.

2013-08-12 Thread Mark Dickinson

Mark Dickinson added the comment:

Yes, I think it would make sense to fix the docs as well, at least for Python 
3.4.  Probably not worth it for the maintenance releases.

--

___
Python tracker 

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



[issue18715] Tests fail when run with coverage

2013-08-12 Thread Ned Deily

Ned Deily added the comment:

Please upload the test results as file attachment(s) to this issue.  Files 
stored elsewhere may disappear.

--
nosy: +ned.deily

___
Python tracker 

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



[issue18677] Enhanced context managers with ContextManagerExit and None

2013-08-12 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue18718] datetime documentation contradictory on leap second support

2013-08-12 Thread David Wolever

New submission from David Wolever:

The documentation for the `%S` formatter suggests that it supports leap 
seconds, but the footnote contradicts that:

> The range really is 0 to 61; according to the Posix standard this
> accounts for leap seconds and the (very rare) double leap seconds.
> The time module may produce and does accept leap seconds since it is
> based on the Posix standard, but the datetime module does not accept
> leap seconds in strptime() input nor will it produce them in
> strftime() output.

I propose that the documentation be updated to mirror the 3.X documentation: no 
leap second in the example and a footnote which makes note of that and suggests 
using the time module.

--
assignee: wolever
messages: 195008
nosy: wolever
priority: normal
severity: normal
status: open
title: datetime documentation contradictory on leap second support
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



  1   2   >