Anselm Kruis | 19 May 2013 20:41
Favicon

[issue18015] python 2.7.5 fails to unpickle namedtuple pickled by 2.7.3 or 2.7.4


New submission from Anselm Kruis:

Change 18303391b981 breaks unpickling named tuples pickled by 2.7.3 and 2.7.4.

See closed issue #15535 for the full story. Unfortunately Raymond was wrong, when he wrote that the
addition of __dict__ was a 2.7.4 change. It was added by changeset 26d5f022eb1a in 2.7.3.

Now 2.7.5 can't unpickle any named tuples pickled by 2.7.3, which is probably one of the most widely used
python versions.

Example:

Pickle a namd tuple using 2.7.3 and unpickle it using 2.7.5.

anselm <at> Emmy:~$ python2.7
Python 2.7.3 (default, Sep 16 2012, 21:46:37) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections
>>> import pickletools
>>> import pickle
>>> N=collections.namedtuple("N","a")
>>> n=N(1)
>>> p=pickle.dumps(n, 2)
>>> p2=pickletools.optimize(p)
>>> pickletools.dis(p2)
    0: \x80 PROTO      2
    2: c    GLOBAL     '__main__ N'
   14: K    BININT1    1
(Continue reading)

Terry J. Reedy | 19 May 2013 19:53
Favicon

[issue18014] Problem compiling on Windows, VC++Express 2010


New submission from Terry J. Reedy:

64-bit Win 7 Professional, using default F7 debug build -- F7
Running as normal user, not admin.

3.4: built Thursday, Saturday; failed Wednesday, Friday, today Sunday.

7> cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL -D_DEBUG -MDd
-DHGBRANCH=\"default\" -DHGTAG=\"tip\" -DHGVERSION=\"79bf4e7e4004\"
..\Modules\getbuildinfo.c
-Fo"D:\Python\dev\cpython\PCbuild\Win32-temp-Debug\pythoncore\getbuildinfo.o" -I..\Include -I..\PC
7>  Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
7>  Copyright (C) Microsoft Corporation.  All rights reserved.
7>  
7>  getbuildinfo.c
7>LINK : fatal error LNK1104: cannot open file 'D:\Python\dev\cpython\PCbuild\python34_d.dll'

I 'updated' back about 24 hours to rev 83828: worked. Forward to rev 83829: failed. This made no sense so back
to '28: failed. Delete python34_d.dll: works. Update to tip: works. Try again: fails.

What I believe to be the case: if python34_d.dll is rebuilt, python_d.exe is built. If not, it 'cannot be
opened' even though it is sitting there. I cannot be sure if this was always the case as I did not try to
rebuild very ofter.

--
3.3 I have not been able to rebuild python_d.exe since May 7. I currently get

7>..\PC\pylauncher.rc(16): error RC2104: undefined keyword or key name: FIELD3 (for pywlauncher project)

(Continue reading)

Florent Xicluna | 19 May 2013 19:45
Favicon

[issue18013] cgi.FieldStorage does not parse W3C sample


New submission from Florent Xicluna:

Trying to parse the W3C sample, it fails in 3.3 (while it passes on 2.7).
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4 (last example)

   Content-Type: multipart/form-data; boundary=AaB03x

   --AaB03x
   Content-Disposition: form-data; name="submit-name"

   Larry
   --AaB03x
   Content-Disposition: form-data; name="files"
   Content-Type: multipart/mixed; boundary=BbC04y

   --BbC04y
   Content-Disposition: file; filename="file1.txt"
   Content-Type: text/plain

   ... contents of file1.txt ...
   --BbC04y
   Content-Disposition: file; filename="file2.gif"
   Content-Type: image/gif
   Content-Transfer-Encoding: binary

   ...contents of file2.gif...
   --BbC04y--
   --AaB03x--

(Continue reading)

Florent Xicluna | 19 May 2013 16:17
Favicon

[issue18012] cannot assign unicode keys to SimpleCookie


New submission from Florent Xicluna:

from Cookie import SimpleCookie

cookie = SimpleCookie()
cookie[u'apple'] = u'green'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py",
line 592, in __setitem__
    self.__set(key, rval, cval)
  File
"/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py",
line 585, in __set
    M.set(key, real_value, coded_value)
  File
"/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py",
line 459, in set
    if "" != translate(key, idmap, LegalChars):
  File
"/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py",
line 493, in translate
    return s.translate(table, deletions)
TypeError: translate() takes exactly one argument (2 given)

The documentation don't say it's not supported.
And the error TypeError seems not appropriate.

(Continue reading)

Serhiy Storchaka | 19 May 2013 10:19
Favicon

[issue18011] Inconsistency between b32decode() documentation, docstring and code


New submission from Serhiy Storchaka:

b32decode() documentation says: "A TypeError is raised if s were incorrectly padded or if there are
non-alphabet characters present in the string."

b32decode() docstring says: "binascii.Error is raised if the input is incorrectly padded or if there are
non-alphabet characters present in the input."

Actually binascii.Error (which is a ValueError subtype) is raised if the input is incorrectly padded and
TypeError is raised if there are non-alphabet characters present in the input.

At least 2 of 3 (documentation, docstring and implementation) should be corrected.

Base32 support was originally added in 3cc0d8fd4e2b (TypeError was used everywhere) and then modified in
eb45f85c4c79 (TypeError was partially changed to binascii.Error).

----------
assignee: docs <at> python
components: Documentation, Library (Lib)
messages: 189571
nosy: barry, docs <at> python, gvanrossum, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Inconsistency between b32decode() documentation, docstring and code
type: behavior
versions: Python 3.3, Python 3.4

_______________________________________
(Continue reading)

Mark Lawrence | 19 May 2013 04:49
Favicon

[issue734176] Make Tkinter.py's nametowidget work with cloned menu widgets


Mark Lawrence added the comment:

Ten years on does anybody actually care about this?  If you do the patch will need reworking as in Python 3 the
code exists in lib/tkinter/__init__.py.

----------

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue734176>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/python-python-bugs-list%40m.gmane.org

Antoine Pitrou | 18 May 2013 19:05
Favicon

[issue18010] pydoc search chokes on import errors


New submission from Antoine Pitrou:

After installing Django, I get the following error in test_pydoc:

======================================================================
FAIL: test_url_requests (test.test_pydoc.PydocUrlHandlerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/cpython/finalize/Lib/test/test_pydoc.py", line 581, in test_url_requests
    self.assertEqual(result, title, text)
AssertionError: 'Pydoc: Error - search?key=pydoc' != 'Pydoc: Search Results'
- Pydoc: Error - search?key=pydoc
+ Pydoc: Search Results

The reason is attempting to import a django.something module raises the following error:

django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not
configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call
settings.configure() before accessing settings

... which isn't silenced by pydoc.

Now I agree this is fundamentally obnoxious on Django's part, but unfortunately it isn't the only package
(IIRC) to behave in this way, meaning it would be nice from pydoc to silence all such errors when an import is attempted.

----------
components: Library (Lib)
messages: 189536
nosy: pitrou
(Continue reading)

Shai Berger | 18 May 2013 18:44
Favicon

[issue18009] os.write.__doc__ is misleading


New submission from Shai Berger:

At least on posix systems, os.write says it takes a string, but in fact it barfs on strings -- it needs bytes.

$ python
Python 3.3.1 (default, May  6 2013, 16:18:33) 
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print(os.write.__doc__)
write(fd, string) -> byteswritten

Write a string to a file descriptor.
>>> os.write(1, "hello")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' does not support the buffer interface
>>> os.write(1, b"hello")
hello5
>>>

----------
messages: 189535
nosy: shai
priority: normal
severity: normal
status: open
title: os.write.__doc__ is misleading
type: behavior
(Continue reading)

William Moreno | 18 May 2013 17:45
Favicon

[issue18008] python33-3.3.2 Parser/pgen: Permission denied


New submission from William Moreno:

cc -DNDEBUG -O2 -pipe  -fno-strict-aliasing -pthread  -pthread Parser/acceler.o  Parser/grammar1.o 
Parser/listnode.o  Parser/node.o  Parser/parser.o  Parser/bitset.o  Parser/metagrammar.o 
Parser/firstsets.o  Parser/grammar.o  Parser/pgen.o Objects/obmalloc.o 
Python/dynamic_annotations.o  Python/mysnprintf.o  Python/pyctype.o  Parser/tokenizer_pgen.o 
Parser/printgrammar.o  Parser/parsetok_pgen.o  Parser/pgenmain.o -lutil -o Parser/pgen
`Parser/pgen' is up to date.
Parser/pgen ./../Grammar/Grammar Include/graminit.h Python/graminit.c
Parser/pgen: Permission denied
*** [Include/graminit.h] Error code 126
cc -c  -DNDEBUG -O2 -pipe  -fno-strict-aliasing -O2 -pipe  -fno-strict-aliasing -O2 -pipe 
-fno-strict-aliasing    -I. -IInclude -I./../Include    -DPy_BUILD_CORE -o Objects/typeobject.o ./../Objects/typeobject.c
/usr/lib/crt1.o: In function `_start':
crt1.c:(.text+0x8a): undefined reference to `main'
Parser/bitset.o: In function `_Py_newbitset':
bitset.c:(.text+0xfa): undefined reference to `Py_FatalError'
Parser/firstsets.o: In function `calcfirstset':
firstsets.c:(.text+0x15): undefined reference to `Py_DebugFlag'
firstsets.c:(.text+0x1d9): undefined reference to `Py_DebugFlag'
firstsets.c:(.text+0x20f): undefined reference to `Py_FatalError'
firstsets.c:(.text+0x329): undefined reference to `Py_FatalError'
Parser/firstsets.o: In function `_Py_addfirstsets':
firstsets.c:(.text+0x345): undefined reference to `Py_DebugFlag'
Parser/grammar.o: In function `_Py_translatelabels':
grammar.c:(.text+0x87): undefined reference to `Py_DebugFlag'
grammar.c:(.text+0x10d): undefined reference to `Py_DebugFlag'
grammar.c:(.text+0x205): undefined reference to `Py_DebugFlag'
grammar.c:(.text+0x234): undefined reference to `Py_DebugFlag'
(Continue reading)

Simon Nicolussi | 18 May 2013 17:45
Favicon

[issue18007] CookieJar expects request objects with origin_req_host attribute instead of method


New submission from Simon Nicolussi:

A fix for a DeprecationWarning (#17678) had the unfortunate side effect of changing the expected
interface of the request object higher up in the call stack.

For example, the documentation for CookieJar.add_cookie_header(request) states that the request
object must support the methods get_full_url(), get_host(), get_type(), unverifiable(),
get_origin_req_host(), has_header(), get_header(), header_items(), and
add_unredirected_header(). The patch for #17678, however, changes the requirement for a
get_origin_req_host() method to an origin_req_host attribute.

This breaks at least one notable third-party library (Kenneth Reitz' Requests).

----------
assignee: docs <at> python
components: Documentation, Library (Lib)
messages: 189523
nosy: docs <at> python, orsenthil, sinic
priority: normal
severity: normal
status: open
title: CookieJar expects request objects with origin_req_host attribute instead of method
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report <at> bugs.python.org>
<http://bugs.python.org/issue18007>
_______________________________________
(Continue reading)

Марк Коренберг | 18 May 2013 13:44
Favicon

[issue18006] Set thread nema in linux kernel


New submission from Марк Коренберг:

In linux (Since 2.6.9) we can use syscall

prctl(PR_SET_NAME, "Some thread name")

to set thread name to the kernel. This thread is seen  under this name in some process tool (like top, ps,
pstree (have bug reported connected with this) and others).

It will be nice if this syscall will be called (from correspoding thread=TID) when changing (setting)
thread name.

Note, that in current implementation name will be truncated to 15 bytes in kernel.

This work very well using ctypes or python-prctl module.

Also there is error in manpage about prctl saying that name is set to process (already sent to maintainer).
Really, name is set to each thread.

----------
components: Library (Lib)
messages: 189507
nosy: mmarkk
priority: normal
severity: normal
status: open
title: Set thread nema in linux kernel
type: enhancement
versions: Python 3.3, Python 3.4, Python 3.5
(Continue reading)


Gmane