[issue19532] compileall -f doesn't force to write bytecode files

2013-11-09 Thread Ned Deily

Ned Deily added the comment:

Looking at the compileall module, it appears that -f and options other than -b 
have never (or, at least, for a long time, not) been supported when directories 
or files are not supplied and it defaults to directories from sys.path.  Note 
the call in main() to compile_path vs those to compile_file or compile_dir.  
I'm not sure if there was a good reason for the difference but it seems like a 
bug now.  Would you care to work on a patch and/or tests?

--
keywords: +easy
nosy: +ned.deily
stage:  - needs patch
versions: +Python 2.7, Python 3.4

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



[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN

New submission from Mike FABIAN:

Originally reported here: 

https://bugzilla.redhat.com/show_bug.cgi?id=1024667

I found that Serbian translations in Latin do not work when the locale
name is written as sr_RS.UTF-8@latin (one gets the cyrillic
translations instead), but they *do* work when the locale name is
written as sr_RS@latin (i.e. omitting the '.UTF-8'):

$ LANG='sr_RS.UTF-8'  python2 -c 'import gettext; 
print(gettext.ldgettext(anaconda, What language would you like to use during 
the installation process?).decode(UTF-8))'
Који језик бисте желели да користите током процеса инсталације?
mfabian@ari:~
$ LANG='sr_RS.UTF-8@latin'  python2 -c 'import gettext; 
print(gettext.ldgettext(anaconda, What language would you like to use during 
the installation process?).decode(UTF-8))'
Који језик бисте желели да користите током процеса инсталације?
mfabian@ari:~
$ LANG='sr_RS@latin'  python2 -c 'import gettext; 
print(gettext.ldgettext(anaconda, What language would you like to use during 
the installation process?).decode(UTF-8))'
Koji jezik biste želeli da koristite tokom procesa instalacije?
mfabian@ari:~
$ 

The “gettext” command line tool does not have this problem:

mfabian@ari:~
$ LANG='sr_RS@latin' gettext anaconda What language would you like to use 
during the installation process?
Koji jezik biste želeli da koristite tokom procesa instalacije?mfabian@ari:~
$ LANG='sr_RS.UTF-8@latin' gettext anaconda What language would you like to 
use during the installation process?
Koji jezik biste želeli da koristite tokom procesa instalacije?mfabian@ari:~
$ LANG='sr_RS.UTF-8' gettext anaconda What language would you like to use 
during the installation process?
Који језик бисте желели да користите током процеса инсталације?mfabian@ari:~
$

--
components: Library (Lib)
messages: 202467
nosy: mfabian
priority: normal
severity: normal
status: open
title: normalize() in locale.py fails for sr_RS.UTF-8@latin
versions: Python 2.7

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



[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN

Mike FABIAN added the comment:

The problem turns out to be caused by a problem in normalizing
the locale name, see the output of  this test program:

mfabian@ari:~
$ cat ~/tmp/mike-test.py
#!/usr/bin/python2

import sys
import os
import locale
import encodings
import encodings.aliases

test_locales = [
'ja_JP.UTF-8',
'de_DE.SJIS',
'de_DE.foobar',
'sr_RS.UTF-8@latin',
'sr_rs@latin',
'sr@latin',
'sr_yu',
'sr_yu.SJIS@devanagari',
'sr@foobar',
'sR@foObar',
'sR',
]

for test_locale in test_locales:
print(%(orig)s - %(norm)s
  %{'orig': test_locale,
'norm': locale.normalize(test_locale)}
)

mfabian@ari:~
$ python2 ~/tmp/mike-test.py
ja_JP.UTF-8 - ja_JP.UTF-8
de_DE.SJIS - de_DE.SJIS
de_DE.foobar - de_DE.foobar
sr_RS.UTF-8@latin - sr_RS.utf_8_latin
sr_rs@latin - sr_RS.UTF-8@latin
sr@latin - sr_RS.UTF-8@latin
sr_yu - sr_RS.UTF-8@latin
sr_yu.SJIS@devanagari - sr_RS.sjis_devanagari
sr@foobar - sr@foobar
sR@foObar - sR@foObar
sR - sr_RS.UTF-8
mfabian@ari:~
$ 

I.e. “sr_RS.UTF-8@latin” is normalized to “sr_RS.utf_8_latin” which
is clearly wrong and causes a fallback to sr_RS when using gettext
which gives the cyrillic translations.

--
Added file: http://bugs.python.org/file32551/mike-test.py

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



[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN

Mike FABIAN added the comment:

A simple fix for that problem could look like this:

mfabian@ari:~
$ diff -u /usr/lib64/python2.7/locale.py.orig /usr/lib64/python2.7/locale.py
--- /usr/lib64/python2.7/locale.py.orig 2013-11-09 09:08:24.807331535 +0100
+++ /usr/lib64/python2.7/locale.py  2013-11-09 09:08:34.526390646 +0100
@@ -377,7 +377,7 @@
 # First lookup: fullname (possibly with encoding)
 norm_encoding = encoding.replace('-', '')
 norm_encoding = norm_encoding.replace('_', '')
-lookup_name = langname + '.' + encoding
+lookup_name = langname + '.' + norm_encoding
 code = locale_alias.get(lookup_name, None)
 if code is not None:
 return code
@@ -1457,6 +1457,7 @@
 'sr_cs@latn':   'sr_RS.UTF-8@latin',
 'sr_me':'sr_ME.UTF-8',
 'sr_rs':'sr_RS.UTF-8',
+'sr_rs.utf8@latin':  'sr_RS.UTF-8@latin',
 'sr_rs.utf8@latn':  'sr_RS.UTF-8@latin',
 'sr_rs@latin':  'sr_RS.UTF-8@latin',
 'sr_rs@latn':   'sr_RS.UTF-8@latin',
mfabian@ari:~
$

--

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



[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN

Mike FABIAN added the comment:

in locale.py, the comment above “locale_alias = {” says:

# Note that the normalize() function which uses this tables
# removes '_' and '-' characters from the encoding part of the
# locale name before doing the lookup. This saves a lot of
# space in the table.

But in normalize(), this is actually not done:

# First lookup: fullname (possibly with encoding)
norm_encoding = encoding.replace('-', '')
norm_encoding = norm_encoding.replace('_', '')
lookup_name = langname + '.' + encoding
code = locale_alias.get(lookup_name, None)

“norm_encoding” holds the locale name with these replacements,
but then it is not used in the lookup.

The patch in http://bugs.python.org/msg202469
fixes that, using the norm_encoding together with adding the alias

+'sr_rs.utf8@latin':  'sr_RS.UTF-8@latin',

makes it work for sr_RS.UTF-8@latin, my test program then outputs:

mfabian@ari:~
$ python2 ~/tmp/mike-test.py
ja_JP.UTF-8 - ja_JP.UTF-8
de_DE.SJIS - de_DE.SJIS
de_DE.foobar - de_DE.foobar
sr_RS.UTF-8@latin - sr_RS.UTF-8@latin
sr_rs@latin - sr_RS.UTF-8@latin
sr@latin - sr_RS.UTF-8@latin
sr_yu - sr_RS.UTF-8@latin
sr_yu.SJIS@devanagari - sr_RS.sjis_devanagari
sr@foobar - sr@foobar
sR@foObar - sR@foObar
sR - sr_RS.UTF-8
mfabian@ari:~
$ 

But note that the normalization of the “sr_yu.SJIS@devanagari”
locale is still weird (of course a “sr_yu.SJIS@devanagari”
is quite silly and does not exist anyway, but the code in normalize()
does not seem to work as intended.

--

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



[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN

Mike FABIAN added the comment:

I think the patch I attach here is a better fix than the
patch in http://bugs.python.org/msg202469 because
it makes the normalize() function behave more logical overall,
with this patch, my test program prints:

mfabian@ari:/local/mfabian/src/cpython (2.7-mike %)
$ ./python ~/tmp/mike-test.py
ja_JP.UTF-8 - ja_JP.UTF-8
de_DE.SJIS - de_DE.SJIS
de_DE.foobar - de_DE.foobar
sr_RS.UTF-8@latin - sr_RS.UTF-8@latin
sr_rs@latin - sr_RS.UTF-8@latin
sr@latin - sr_RS.UTF-8@latin
sr_yu - sr_RS.UTF-8@latin
sr_yu.SJIS@devanagari - sr_RS.SJIS@devanagari
sr@foobar - sr_RS.UTF-8@foobar
sR@foObar - sr_RS.UTF-8@foobar
sR - sr_RS.UTF-8
[18995 refs]
mfabian@ari:/local/mfabian/src/cpython (2.7-mike %)
$ 

The patch also contains a small fix for the “ks” and “sd”
locales in the locale_alias dictionary, they had the “.UTF-8”
in the wrong place:

-'ks_in@devanagari': 'ks...@devanagari.utf-8',
+'ks_in@devanagari': 'ks_IN.UTF-8@devanagari',

-'sd':   'sd...@devanagari.utf-8',
+'sd':   'sd_IN.UTF-8@devanagari',

(This error is inherited from the locale.alias file from X.org
where the locale_alias dictionary is generated from)

--
keywords: +patch
Added file: 
http://bugs.python.org/file32552/0001-Issue-19534-fix-normalize-in-locale.py-to-make-it-wo.patch

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



[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN

Mike FABIAN added the comment:

The patch

http://bugs.python.org/file32552/0001-Issue-19534-fix-normalize-in-locale.py-to-make-it-wo.patch

is against the current HEAD of the 2.7 branch, but
Python 3.3 has exactly the same problem, the same patch fixes it for python
3.3 as well.

--

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



[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Seems this is a duplicate of issue5815.

--
nosy: +serhiy.storchaka
superseder:  - locale.getdefaultlocale() missing corner case

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



[issue18907] urllib2.open FTP open times out at 20 secs despite timeout parameter

2013-11-09 Thread Charles-François Natali

Changes by Charles-François Natali cf.nat...@gmail.com:


--
resolution:  - wont fix
stage:  - committed/rejected
status: open - closed

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Some tests fail when ran with -OO and then with -O. Short example (there are 
more examples):

$ rm -rf Lib/test/__pycache__
$ ./python -OO -m test.regrtest test_property
[1/1] test_property
1 test OK.
$ ./python -O -m test.regrtest test_property
[1/1] test_property
test test_property failed -- multiple errors occurred; run in verbose mode for 
details
1 test failed:
test_property

--
components: +Tests
nosy: +serhiy.storchaka, skrah
type: enhancement - behavior
versions: +Python 2.7, Python 3.4

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



[issue19531] Loading -OO bytecode files if -O was requested can lead to problems

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Some tests fail when ran with -OO and then with -O. Short example (there are 
more examples):

$ rm -rf Lib/test/__pycache__
$ ./python -OO -m test.regrtest test_property
[1/1] test_property
1 test OK.
$ ./python -O -m test.regrtest test_property
[1/1] test_property
test test_property failed -- multiple errors occurred; run in verbose mode for 
details
1 test failed:
test_property

--
components: +Tests
nosy: +serhiy.storchaka, skrah
type: enhancement - behavior
versions: +Python 2.7, Python 3.4

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


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

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
components:  -Tests
type: behavior - enhancement
versions:  -Python 3.3, Python 3.4

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
versions: +Python 3.3 -Python 2.7

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



[issue19535] Test failures with -OO

2013-11-09 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

$ ./python -OO -m test.regrtest test_docxmlrpc test_functools test_inspect 
test_pkg
[1/4] test_docxmlrpc
test test_docxmlrpc failed -- Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/test/test_docxmlrpc.py, line 210, in 
test_annotations
response.read())
AssertionError: b'dldta 
name=-annotationstrongannotation/strong/a(x: 
int)/dtddttUsenbsp;functionnbsp;annotations./tt/dd/dl\ndldta 
name=-method_annotationstrongmethod_annotation/strong/a(x: 
bytes)/dt/dl' not found in b'!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.0 
Transitional//EN\nhtmlheadtitlePython: DocXMLRPCServer Test 
Documentation/title\nmeta http-equiv=Content-Type content=text/html; 
charset=utf-8\n/headbody bgcolor=#f0f0f8\n\ntable width=100% 
cellspacing=0 cellpadding=2 border=0 summary=heading\ntr 
bgcolor=#7799ee\ntd valign=bottomnbsp;br\nfont color=#ff 
face=helvetica, arialnbsp;brbigbigstrongDocXMLRPCServer Test 
Docs/strong/big/big/font/td\ntd align=right valign=bottom\nfont 
color=#ff face=helvetica, arialnbsp;/font/td/tr/table\n
pttThisnbsp;isnbsp;annbsp;XML-RPCnbsp;server\'snbsp;documentation,nbsp;butnbsp;thenbsp;servernbsp;can
 
nbsp;benbsp;usednbsp;bynbsp;POSTingnbsp;tonbsp;/RPC2.nbsp;Trynbsp;self.strongadd/strong,nbsp;too./tt/p\np\ntable
 width=100% cellspacing=0 cellpadding=2 border=0 summary=section\ntr 
bgcolor=#eeaa77\ntd colspan=3 valign=bottomnbsp;br\nfont 
color=#ff face=helvetica, 
arialbigstrongMethods/strong/big/font/td/tr\n\ntrtd 
bgcolor=#eeaa77ttnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/tt/tdtdnbsp;/td\ntd
 width=100%dldta 
name=-lt;lambdagt;stronglt;lambdagt;/strong/a(x, 
y)/dt/dl\ndldta name=-addstrongadd/strong/a(x, 
y)/dt/dl\ndldta name=-annotationstrongannotation/strong/a(x: 
int)/dt/dl\ndldta 
name=-method_annotationstrongmethod_annotation/strong/a(x: 
bytes)/dt/dl\ndldta 
name=-system.listMethodsstrongsystem.listMethods/strong/a()/dt/dl\ndldta
 
name=-system.methodHelpstrongsystem.methodHelp/strong/a(method_name)/dt
 /dl\ndldta 
name=-system.methodSignaturestrongsystem.methodSignature/strong/a(method_name)/dt/dl\n/td/tr/table\n/body/html'

[2/4/1] test_functools
test test_functools failed -- Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/test/test_functools.py, line 1127, in 
test_wrapping_attributes
self.assertEqual(g.__doc__, Simple test)
AssertionError: None != 'Simple test'

[3/4/2] test_inspect
test test_inspect failed -- Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/test/test_inspect.py, line 2528, in 
test_details
self.assertIn(module.__cached__, output)
AssertionError: 
'/home/serhiy/py/cpython/Lib/unittest/__pycache__/__init__.cpython-34.pyo' not 
found in Target: unittest\nOrigin: 
/home/serhiy/py/cpython/Lib/unittest/__init__.py\nCached: 
/home/serhiy/py/cpython/Lib/unittest/__pycache__/__init__.cpython-34.pyc\nLoader:
 _frozen_importlib.SourceFileLoader object at 0xb7041c4c\nSubmodule search 
path: ['/home/serhiy/py/cpython/Lib/unittest']\n\n\n

[4/4/3] test_pkg
1 test OK.
3 tests failed:
test_docxmlrpc test_functools test_inspect

--
components: Tests
messages: 202476
nosy: serhiy.storchaka, skrah
priority: normal
severity: normal
status: open
title: Test failures with -OO
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue19535] Test failures with -OO

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Failure of test_pkg is sporadic.

$ ./python -OO -m test.regrtest test_pkg
[1/1] test_pkg
test test_pkg failed -- Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/test/test_pkg.py, line 259, in test_7
'__name__', '__package__', '__path__'])
AssertionError: Lists differ: ['__c[22 chars]__file__', '__loader__', 
'__name__', '__package__'] != ['__c[22 chars]__file__', '__loader__', 
'__name__', '__package__', '__path__']

Second list contains 1 additional elements.
First extra element 6:
__path__

- ['__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__']
+ ['__cached__',
+  '__doc__',
+  '__file__',
+  '__loader__',
+  '__name__',
+  '__package__',
+  '__path__']

1 test failed:
test_pkg

--

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



[issue11849] glibc allocator doesn't release all free()ed memory

2013-11-09 Thread STINNER Victor

STINNER Victor added the comment:

Extract of the workaround section:
You could also run your Python jobs using Jython, which uses the Java JVM
and does not exhibit this behavior. Likewise, you could upgrade to Python
3.3 http://bugs.python.org/issue11849,

Which contains a link to this issue.

--

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



[issue19504] Change customise to customize.

2013-11-09 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue19532] compileall -f doesn't force to write bytecode files

2013-11-09 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Attached the patch to fix the problem. I did not modify the unit test because 
the bug was located in the __main__ part of Lib/compileall.

--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file32553/compileall_force.patch

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



[issue19536] MatchObject should offer __getitem__()

2013-11-09 Thread Brandon Rhodes

New submission from Brandon Rhodes:

Regular expression re.MatchObject objects are sequences.
They contain at least one “group” string, possibly more,
which are integer-indexed starting at zero.
Today, groups can be accessed in one of two ways.

(1) You can call the method match.group(N).

(2) You can call glist = match.groups()
and then access each group as glist[N-1].
Note the obvious off-by-one error:
.groups() does not include “group zero”,
which contains the entire match,
and therefore its indexes are off-by-one
from the values you would pass to .group().

I propose that MatchObject gain a __getitem__(N) method
whose return value for every N is the same as .group(N)
as I think that match[N] is a quite obvious syntax for
asking for one particular group of an RE match.

The only objection I can see to this proposal
is the obvious asymmetry between Group Zero and all
subsequent groups of a regular expression pattern:
zero means “the whole thing” whereas each of the others
holds the content of a particular explicit set of parens.
Looping over the elements match[0], match[1], ... of a
pattern like this:

r'(\d\d\d\d)/(\d\d)/(\d\d)'

will give you *first* the *entire* match, and only then
turn its attention to the three parenthesized substrings.

My retort is that concentric groups can happen anyway:
that Group Zero, holding the entire match, is not really
as special as the newcomer might suspect, because you can
always wind up with groups inside of other groups; it is
simply part of the semantics of regular expressions that
groups might overlap or might contain one another, as in:

r'((\d\d)/(\d\d)) Description: (.*)'

Here, we see that concentricity is not a special property
of Group Zero, but in fact something that can happen quite
naturally with other groups.

The caller simply needs to imagine every regular expression
being surrounded by an “automatic set of parentheses” to
understand where Group Zero comes from, and how it will be
ordered in the resulting sequence of groups relative to
the subordinate groups within the string.

If one or two people voice agreement here in this issue,
I will be very happy to offer a patch.

--
components: Regular Expressions
messages: 202480
nosy: brandon-rhodes, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: MatchObject should offer __getitem__()
type: enhancement
versions: Python 3.5

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



[issue19536] MatchObject should offer __getitem__()

2013-11-09 Thread Brandon Rhodes

Changes by Brandon Rhodes bran...@rhodesmill.org:


--
versions: +Python 3.4 -Python 3.5

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



[issue19536] MatchObject should offer __getitem__()

2013-11-09 Thread Ezio Melotti

Ezio Melotti added the comment:

This is something that the regex module already has, and since it is/was 
supposed to replace the re module in stdlib, I've been holding off to add to re 
for a long time.  We also discussed this recently on #python-dev, and I think 
it's OK to add it, as long as it behaves the same way as it does in the regex 
module.
If others agree it would be great to do it before the 3.4 feature freeze (there 
aren't many days left).

--
nosy: +christian.heimes, serhiy.storchaka
stage:  - needs patch

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



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

2013-11-09 Thread Brett Cannon

Brett Cannon added the comment:

I don't quite know what you mean by current functional changes in the clone. 
Is this changes to import to use exec_module() and such? Just a guess since 
step 3 suggests there are no loaders implementing the new API currently.

As for the tests, I'm hoping that simply refactoring some of them will allow 
reusing a bunch of the finder  loader tests instead of having to do it from 
scratch.

--

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



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

2013-11-09 Thread Brett Cannon

Brett Cannon added the comment:

I should clarify why I want a clarification on step 1. On Friday my current 
plan (barring other bugs I need to squash for b1) is to just start working on 
the pep-451 repo and I want a TODO list to follow in this issue so I don't have 
to waste time trying to figure out what to work on next. That's why I want it 
spelled out if we want the loaders fixed first or import, etc.

--

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



[issue19531] Loading -OO bytecode files if -O was requested can lead to problems

2013-11-09 Thread Brett Cannon

Brett Cannon added the comment:

This is a known problem and has been brought up over the years. Discussions 
have typically revolved around expanding the .pyc format to encode what 
optimizations were used so if the interpreter was using different optimizations 
it would not use the bytecode.

--
nosy: +brett.cannon

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Brett Cannon

Brett Cannon added the comment:

Do realize this is a one-time memory cost, though, because next execution will 
load from the .pyo and thus will never load the docstring into memory. If you 
pre-compile all bytecode with -OO this will never even occur.

--
nosy: +brett.cannon

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Sworddragon

Sworddragon added the comment:

 Do realize this is a one-time memory cost, though, because next execution 
 will load from the .pyo and thus will never load the docstring into memory.

Except in 2 cases:

- The bytecode was previously generated with -O.
- The bytecode couldn't be written (for example permission issues or Python was 
invoked with -B).

--

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



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-09 Thread Andreas Schwab

New submission from Andreas Schwab:

sizeof(foo) is never a good approximation for the alignment of foo

--
components: Interpreter Core
files: xx
messages: 202487
nosy: schwab
priority: normal
severity: normal
status: open
title: Fix misalignment in fastsearch_memchr_1char
type: behavior
versions: Python 3.3
Added file: http://bugs.python.org/file32554/xx

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



[issue19536] MatchObject should offer __getitem__()

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

We discussed this recently on #python-dev, and I don't think that it's worth to 
add indexing to match object. It will be confused that len(match) != 
len(match.groups()). I don't know any use case for indexing, it doesn't add 
anything new except yet one way to access a group. This feature not only 
increases maintaining complexity, but it also increases a number of things 
which should learn and remember Python programmer.

--

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



[issue19537] Fix misalignment in fastsearch_memchr_1char

2013-11-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +serhiy.storchaka
stage:  - patch review
versions: +Python 3.4

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



[issue19499] import this is cached in sys.modules

2013-11-09 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Terry is right here. The this module doesn't seem to have been thought as an 
educational tool in the first place.

--
nosy: +pitrou

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




[issue19532] compileall -f doesn't force to write bytecode files

2013-11-09 Thread R. David Murray

R. David Murray added the comment:

test_compileall has fairly extensive tests of the command line behavior, added 
when we refactored from optparse to argparse.  So a test should be added for 
this case.

--
nosy: +r.david.murray

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread R. David Murray

R. David Murray added the comment:

So the question is, if there is no longer a reference to the docstring, why 
isn't it garbage collected?  (I tested adding a gc.collect(), and it didn't 
make any difference.)

--
nosy: +r.david.murray

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



[issue18874] Add a new tracemalloc module to trace memory allocations

2013-11-09 Thread STINNER Victor

STINNER Victor added the comment:

 2013-11-09 06:53:03   neologixset files: + 3bf73dcd0b42.diff

I guess that you clicked on [Create Patch]. This button doesn't work, it 
generates a patch with unrelated changes. Maybe I did something wrong on 
features/tracemalloc repository.

Here is a patch of the revision 8b34364a66a9 (which does not contain 
add_filter()): 8b34364a66a9.patch

--
Added file: http://bugs.python.org/file32555/8b34364a66a9.patch

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



[issue19085] Add tkinter basic options tests

2013-11-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset be8f9beca8aa by Serhiy Storchaka in branch '2.7':
Fix Tkinter tests on Tk 8.5 with patchlevel  8.5.11 (issue #19085).
http://hg.python.org/cpython/rev/be8f9beca8aa

New changeset 204e66190dbb by Serhiy Storchaka in branch '3.3':
Fix Tkinter tests on Tk 8.5 with patchlevel  8.5.11 (issue #19085).
http://hg.python.org/cpython/rev/204e66190dbb

New changeset 2834e410d1ae by Serhiy Storchaka in branch 'default':
Fix Tkinter tests on Tk 8.5 with patchlevel  8.5.11 (issue #19085).
http://hg.python.org/cpython/rev/2834e410d1ae

--

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



[issue19499] import this is cached in sys.modules

2013-11-09 Thread Ezio Melotti

Ezio Melotti added the comment:

I think this should be closed as won't fix.

Having import this behave differently from any other import is 
counter-intuitive (students will start asking why if I reimport 'this' the 
code gets executed every time but it doesn't work with my module?).

If they want to read the Zen over and over again they can check PEP 20.

--
nosy: +ezio.melotti

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



[issue19227] test_multiprocessing_xxx hangs under Gentoo buildbots

2013-11-09 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
resolution:  - fixed
status: open - closed

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



[issue19538] Changed function prototypes in the PEP 384 stable ABI

2013-11-09 Thread Thomas Heller

New submission from Thomas Heller:

(As requested by email in python-dev I'm reporting this problem)

Some function prototypes in the stable ABI have been changed between Python 3.3 
and 3.4.
PyObject_CallFunction is an example, the second parameter has been changed from 
'char *' to 'const char *', which leads to compiler warnings in my code.

I admit that my use case is probably weird, but here we go:

I want to embed Python and use the stable ABI (API?) so that I the executable 
does not have to be recompiled for different Python versions.  I want to link 
dynamically to the Python runtime (loaded with LoadLibrary on Windows).  Also I 
do not want in use python3.dll.

To make calling the functions less painful I ended up with the following 
approach.

My executable is compiled with 'Py_BUILD_CORE' defined so that I can 
*implement* PyObject_CallFunction myself.  I have a python-dynload.c file which 
implements the API functions in this way:

#define Py_BUILD_CORE
#include Python.h
HMODULE hPyDLL; /* the module handle of a dynamically loaded python3X.dll */

PyObject *PyObject_CallFunction(PyObject *callable, char *format, ...)
{
   /* implement by forwarding to functions in the dynloaded dll */
}

When I compile this code with the Python 3.3 headers, everything is ok.  With 
the Python 3.4 headers, I get

  source/python-dynload.c(75) : warning C4028: formal parameter 2 different 
from declaration

When I change the second parameter in the function definition to 'const char 
*format', the situation reverses, compiling with 3.3 gives the warning but 3.4 
is ok.

--
components: Build
keywords: 3.3regression
messages: 202495
nosy: theller
priority: normal
severity: normal
status: open
title: Changed function prototypes in the PEP 384 stable ABI
versions: Python 3.3, Python 3.4, Python 3.5

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



[issue19020] Regression: Windows-tkinter-idle, unicode, and 0xxx filename

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Tests added in issue19085 have a special case for tuple values because 
widget[name] and widget.configure(name) return different results in such cases. 
When remove this special case, following tests fails:

==
FAIL: test_text (tkinter.test.test_ttk.test_widgets.ButtonTest)
--
Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 381, in 
test_text
self.checkParams(widget, 'text', '', 'any string')
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 89, in 
checkParams
self.checkParam(widget, name, value, **kwargs)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 63, in 
checkParam
self.assertEqual2(t[4], expected, eq=eq)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 41, in 
assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: ('any', 'string') != 'any string'

==
FAIL: test_offvalue (tkinter.test.test_ttk.test_widgets.CheckbuttonTest)
--
Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py, 
line 248, in test_offvalue
self.checkParams(widget, 'offvalue', 1, 2.3, '', 'any string')
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 89, in 
checkParams
self.checkParam(widget, name, value, **kwargs)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 63, in 
checkParam
self.assertEqual2(t[4], expected, eq=eq)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 41, in 
assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: ('any', 'string') != 'any string'

==
FAIL: test_onvalue (tkinter.test.test_ttk.test_widgets.CheckbuttonTest)
--
Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py, 
line 252, in test_onvalue
self.checkParams(widget, 'onvalue', 1, 2.3, '', 'any string')
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 89, in 
checkParams
self.checkParam(widget, name, value, **kwargs)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 63, in 
checkParam
self.assertEqual2(t[4], expected, eq=eq)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 41, in 
assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: ('any', 'string') != 'any string'

==
FAIL: test_text (tkinter.test.test_ttk.test_widgets.CheckbuttonTest)
--
Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 381, in 
test_text
self.checkParams(widget, 'text', '', 'any string')
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 89, in 
checkParams
self.checkParam(widget, name, value, **kwargs)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 63, in 
checkParam
self.assertEqual2(t[4], expected, eq=eq)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 41, in 
assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: ('any', 'string') != 'any string'

==
FAIL: test_values (tkinter.test.test_ttk.test_widgets.ComboboxTest)
--
Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/tkinter/test/test_ttk/test_widgets.py, 
line 363, in test_values
self.checkParam(self.combo, 'values', (42, 3.14, '', 'any string'))
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 63, in 
checkParam
self.assertEqual2(t[4], expected, eq=eq)
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 41, in 
assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: Tuples differ: (42, 3.14, '', ('any', 'string')) != (42, 3.14, 
'', 'any string')

First differing element 3:
('any', 'string')
any string

- (42, 3.14, '', ('any', 'string'))
?--

+ (42, 3.14, '', 'any string')
?^


==
FAIL: test_text (tkinter.test.test_ttk.test_widgets.LabelFrameTest)
--
Traceback (most recent call last):
  File /home/serhiy/py/cpython/Lib/tkinter/test/widget_tests.py, line 381, in 

[issue19538] Changed function prototypes in the PEP 384 stable ABI

2013-11-09 Thread Ezio Melotti

Ezio Melotti added the comment:

See #9369 and #1772673.

--
nosy: +ezio.melotti, serhiy.storchaka
type:  - behavior

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



[issue5815] locale.getdefaultlocale() missing corner case

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping. There are two duplicate issues opened last month.

--

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



[issue16685] audioop functions shouldn't accept strings

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If there are no objections I will commit last patch tomorrow.

--

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Stefan Krah

Stefan Krah added the comment:

R. David Murray rep...@bugs.python.org wrote:
 So the question is, if there is no longer a reference to the docstring, why 
 isn't it garbage collected?  (I tested adding a gc.collect(), and it didn't 
 make any difference.)

I think it probably is garbage collected but the freed memory is not returned 
to the OS
by the memory allocator.

--

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



[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread R. David Murray

R. David Murray added the comment:

Hmm.  If I turn on gc debugging before the def, I don't see anything get 
collected.  If I allocate a series of new 10K strings, the memory keeps 
growing.  Of course, that could still be down to the vagaries of OS memory 
management.  Time to break out Victor's tracemalloc, but I probably don't have 
that much ambition today :)

--

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



[issue1575020] Request wave support 16 bit samples

2013-11-09 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5fbcb4aa48fa by Serhiy Storchaka in branch '2.7':
Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms.
http://hg.python.org/cpython/rev/5fbcb4aa48fa

New changeset 79b8b7c5fe8a by Serhiy Storchaka in branch '3.3':
Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms.
http://hg.python.org/cpython/rev/79b8b7c5fe8a

New changeset 1ee45eb6aab9 by Serhiy Storchaka in branch 'default':
Issue #1575020: Fixed support of 24-bit wave files on big-endian platforms.
http://hg.python.org/cpython/rev/1ee45eb6aab9

--
nosy: +python-dev

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



[issue1575020] Request wave support 16 bit samples

2013-11-09 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue19538] Changed function prototypes in the PEP 384 stable ABI

2013-11-09 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue19530] cross thread shutdown of UDP socket exhibits unexpected behavior

2013-11-09 Thread mpb

mpb added the comment:

After some research...

 Which is normal, since UDP sockets aren't connected.

But UDP sockets can be connected!

If I connect the UDP sockets, then shutdown succeeds (no exception is raised), 
but recvfrom still appears to succeed, returning a zero length message with a 
bogus address family, IP address and port.  (Bogus even if I set them to zero 
before the call!)

FYI, the FreeBSD (and OpenBSD) shutdown manpages anticipate calling shutdown on 
DGRAM sockets.  And the Linux connect manpage discusses connecting DGRAM 
sockets.

Here is the updated Python code.  I do expect to try to report this upstream.  
(Also, I now have C/pthreads code, if you want to see it.  As expected, C 
behaves identically.)



import socket, threading, time

fd_0 = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
fd_0.bind(('localhost', 8000))
fd_0.connect (('localhost', 8001))

fd_1 = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
fd_1.bind(('localhost', 8001))
fd_1.connect (('localhost', 8000))

def thread_main ():
  for i in range (3) :
# print ('recvfrom  blocking ...')  
recv, remote_addr = fd_0.recvfrom (1024)
print ('recvfrom  %s  %s' % (recv, remote_addr))

def main ():
  fd_1.send (b'test')
  fd_1.send (b'')
  fd_0.shutdown (socket.SHUT_RD)

thread = threading.Thread ( target = thread_main )
thread.start ()
time.sleep (0.5)
main ()
thread.join ()
print ('exiting')



And the code outputs:
recvfrom  b'test'  ('127.0.0.1', 8001)
recvfrom  b''  ('127.0.0.1', 8001)
recvfrom  b''  (36100, b'\xe4\xc6\xf0^7\xe2\x85\xf8\x07\xc1\x04\x8d\xe4\xc6')
exiting

--

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



[issue10197] subprocess.getoutput fails on win32

2013-11-09 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

Lib/subprocess.py still has outdated comment:

# NB This only works (and is only relevant) for POSIX.

--
nosy: +Arfrever

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



[issue13248] deprecated in 3.2/3.3, should be removed in 3.4

2013-11-09 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage:  - patch review

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



[issue18802] ipaddress documentation errors

2013-11-09 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage:  - patch review

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



[issue19539] The 'raw_unicode_escape' codec buggy + not apropriate for Python 3.x

2013-11-09 Thread Jan Kaliszewski

New submission from Jan Kaliszewski:

It seems that the 'raw_unicode_escape' codec:

1) produces data that could be suitable for Python 2.x raw unicode string 
literals and not for Python 3.x raw unicode string literals (in Python 3.x 
\u... escapes are also treated literally);

2) seems to be buggy anyway: bytes in range 128-255 are encoded with the 
'latin-1' encoding (in Python 3.x it is definitely a bug; and even in Python 
2.x the feature is dubious, although at least the Py2's eval() and compile() 
functions officially accept 'latin-1'-encoded byte strings...).

Python 3.3:

 b = zażółć.encode('raw_unicode_escape')
 literal = b'r' + b + b''
 literal
b'rza\\u017c\xf3\\u0142\\u0107'
 eval(literal)
Traceback (most recent call last):
  File stdin, line 1, in module
  File string, line 1
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xf3 in position 
8: invalid continuation byte
 b'\xf3'.decode('latin-1')
'ó'
 b = zaż.encode('raw_unicode_escape')
 literal = b'r' + b + b''
 literal
b'rza\\u017c'
 eval(literal)
'za\\u017c'
 print(eval(literal))
za\u017c

It believe that the 'raw_unicode_escape' codes should either be deprecated and 
later removed or be modified to accept only printable ascii characters.


PS. Also, as a side note: neither 'raw_unicode_escape' nor 'unicode_escape' 
does escape quotes (see issue #7615) -- shouldn't it be at least documented 
explicitly?

--
components: Library (Lib), Unicode
messages: 202505
nosy: ezio.melotti, haypo, zuo
priority: normal
severity: normal
status: open
title: The 'raw_unicode_escape' codec buggy + not apropriate for Python 3.x
versions: Python 3.4, Python 3.5

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



[issue19540] PEP339: Fix link to Zephyr ASDL paper

2013-11-09 Thread anatoly techtonik

Changes by anatoly techtonik techto...@gmail.com:


--
assignee: docs@python
components: Documentation
hgrepos: 213
nosy: docs@python, techtonik
priority: normal
severity: normal
status: open
title: PEP339: Fix link to Zephyr ASDL paper

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



[issue19541] ast.dump(indent=True) prettyprinting

2013-11-09 Thread anatoly techtonik

New submission from anatoly techtonik:

ast.dump needs an indent argument for pretty printing.

  from pprint import pprint as pp
  pp(ast.dump(node))

  Assign(targets=[Tuple(elts=[Name(id='d', ctx=Store()), Name(id='m', 
ctx=Store())], ctx=Store())], value=Call(func=Name(id='divmod', ctx=Load()), 
args=[Call(func=Name(id='len', ctx=Load()), args=[Name(id='seq', ctx=Load())], 
keywords=[], starargs=None, kwargs=None), Name(id='size', ctx=Load())], 
keywords=[], starargs=None, kwargs=None))

--
assignee: docs@python
components: Documentation
messages: 202506
nosy: docs@python, techtonik
priority: normal
severity: normal
status: open
title: ast.dump(indent=True) prettyprinting

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



[issue19539] The 'raw_unicode_escape' codec buggy + not apropriate for Python 3.x

2013-11-09 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The 'raw_unicode_escape' codec can't be neither removed nor changed because it 
is used in pickle protocol. Just don't use it if its behavior looks weird for 
you.

Right way to decode raw_unicode_escape-encoded data is use 'raw_unicode_escape' 
decoder.

If a string don't contain quotes, you can use eval(), but you should first 
decode data from latin1 and encode to UTF-8:

 literal = ('r%s' % 
 zażółć.encode('raw_unicode_escape').decode('latin1')).encode()
 literal
b'rza\\u017c\xc3\xb3\\u0142\\u0107'
 eval(literal)
'za\\u017có\\u0142\\u0107'

--
nosy: +serhiy.storchaka

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