[issue7436] Define 'object with assignable attributes'

2010-12-26 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +durban

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



[issue9196] Improve docs for string interpolation %s re Unicode strings

2010-12-26 Thread Craig McQueen

Craig McQueen pyt...@craig.mcqueen.id.au added the comment:

I should be able to attach my test code. But it is at my work, and I'm on 
holidays for 2 more weeks. Sorry 'bout that!

I do assume that Python 3 greatly simplifies this.

--

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



[issue10769] ast: provide more useful range information

2010-12-26 Thread Sven Brauch

Sven Brauch svenbra...@googlemail.com added the comment:

Hi,

yeah Terry, that's exactly what most people whom I talked about this said (me 
too).

Anyway, here's the patch which -- in my opinion -- fixes this behavior:

--- python-orig/Python/ast.c 2010-10-19 03:22:07.0 +0200
+++ python-ast-fix/Python/ast.c 2010-12-26 13:25:48.0 +0100
@@ -1742,8 +1742,6 @@
 tmp = ast_for_trailer(c, ch, e);
 if (!tmp)
 return NULL;
-tmp-lineno = e-lineno;
-tmp-col_offset = e-col_offset;
 e = tmp;
 }
 if (TYPE(CHILD(n, NCH(n) - 1)) == factor) {

The offsets for foo.bar.baz before the patch:

[1, 0, _ast.Attribute]
[1, 0, _ast.Attribute, 'baz']
[1, 0, _ast.Name, 'bar']
[1, 0, 'foo']

... and after the patch:

[1, 0, _ast.Attribute]
[1, 7, _ast.Attribute, 'baz']
[1, 3, _ast.Name, 'bar']
[1, 0, 'foo']

It would really be great if that could be applied.

Best regards,
Sven

--

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



[issue10576] Add a progress callback to gcmodule

2010-12-26 Thread Lukas Lueg

Lukas Lueg lukas.l...@gmail.com added the comment:

Collection may re-occur at any time, there is no promise to the callback code. 
However, the callback can disable the gc, preventing further collection.

I don't think we need the other callbacks to be informed. As the callbacks are 
worked down in the order they registered, whoever comes first is served first. 
Returning True from the callback is mereley a I dont mind if gc happens now...

--

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



[issue2504] Add gettext.pgettext() and variants support

2010-12-26 Thread Felix Schwarz

Changes by Felix Schwarz felix.schw...@web.de:


--
nosy: +Felix Schwarz

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



[issue10773] Building C and C++ Extensions on Windows documentation shows 2.x way of initializing module

2010-12-26 Thread Thorsten Behrens

New submission from Thorsten Behrens sbehr...@gmx.li:

The documentation titled Building C and C++ Extensions on Windows at 
http://docs.python.org/py3k/extending/windows.html shows a Python 2.x way of 
handling static type object initializers, to whit:


If your module creates a new type, you may have trouble with this line:

PyVarObject_HEAD_INIT(PyType_Type, 0)

Static type object initializers in extension modules may cause compiles to fail 
with an error message like “initializer not a constant”. This shows up when 
building DLL under MSVC. Change it to:

PyVarObject_HEAD_INIT(NULL, 0)

and add the following to the module initialization function:

MyObject_Type.ob_type = PyType_Type;



That last line will not function in Python 3.x. However, PyType_Ready will fill 
in the ob_type field if it is empty, if I understand PyType_Ready correctly. 
Therefore, the last few lines of this documentation snippet can become:


and add the following to the module initialization function:

if (PyType_Ready(MyObject_Type)  0)
return NULL;


--
assignee: d...@python
components: Documentation
messages: 124667
nosy: d...@python, thorsten.behrens
priority: normal
severity: normal
status: open
title: Building C and C++ Extensions on Windows documentation shows 2.x way 
of initializing module
versions: Python 3.1

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



[issue6720] multiprocessing logging

2010-12-26 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

This is either out of date (2.5 doesn’t get bugfixes any more) or invalid 
(concerns a backport of multiprocessing outside of the stdlib).

--
nosy: +eric.araujo
resolution:  - rejected
stage:  - committed/rejected
status: open - closed
type: crash - behavior

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



[issue10774] test_logging leaks temp files

2010-12-26 Thread Éric Araujo

New submission from Éric Araujo mer...@netwok.org:

After a test_logging run in 3.2, I get stray files in $TMP.  I think some test 
is not using the right mixin or addCleanup or tearDown.

Less importantly, some recently added docstrings produce unwanted output on the 
console (the method name is clear enough, the redundant docstring is 
redundant); attached output turns them into comments.

--
assignee: vinay.sajip
components: Tests
files: test_logging-nits.diff
keywords: patch
messages: 124669
nosy: eric.araujo, vinay.sajip
priority: normal
severity: normal
stage: needs patch
status: open
title: test_logging leaks temp files
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file20168/test_logging-nits.diff

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



[issue10756] Error in atexit._run_exitfuncs [...] Exception expected for value, str found

2010-12-26 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Looks good to me.  I’d just move the raising function into the test method (no 
need to update the patch).

--
nosy: +eric.araujo
stage:  - patch review

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



[issue10770] zipinfo - fix of a typo in the doc

2010-12-26 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Fixed, thanks.  Note that Georg and I follow the docs mailing list, so there is 
no need to open a report for each message.

--
nosy: +eric.araujo
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

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



[issue10774] test_logging leaves temp files

2010-12-26 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
title: test_logging leaks temp files - test_logging leaves temp files

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



[issue5258] addpackage in site.py fails hard on badly formed .pth files

2010-12-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Here is a revised patch with tests.

--
Added file: http://bugs.python.org/file20169/site_pth_exceptions.diff

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



[issue10756] Error in atexit._run_exitfuncs [...] Exception expected for value, str found

2010-12-26 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

+1.

--
nosy: +georg.brandl

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



[issue5258] addpackage in site.py fails hard on badly formed .pth files

2010-12-26 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

LGTM.

--

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



[issue10775] assertRaises as a context manager should accept a 'msg' keyword argument.

2010-12-26 Thread R. David Murray

New submission from R. David Murray rdmur...@bitdance.com:

assertRaises used as a method can't take a msg keyword argument because all 
args and keywords are passed to the callable.  But in context manager form it 
could, and this can be useful.  See, for example, issue 3583.

--
keywords: easy
messages: 124675
nosy: michael.foord, r.david.murray, rhettinger
priority: normal
severity: normal
stage: needs patch
status: open
title: assertRaises as a context manager should accept a 'msg' keyword argument.
type: feature request
versions: Python 3.3

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



[issue3583] test_urllibnet.test_bad_address() fails when using OpenDNS

2010-12-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I think the best we can do here is add a message explaining that the error may 
be due to a broken DNS server (one with a wildcard dns record for all 
non-existent top level domains).  However, assertRaises, even in context 
manager form, doesn't take a msg argument (yet).  I've opened an issue with a 
feature request to fix that and made it a dependency of this issue.

Note that the test uses a domain name ending in .d, and for a while before 
that used '.invalid', so the test should not fail if the ISP is only capturing 
valid top level domains with wildcards, something that seems to be far more 
common than catching invalid domains.

--
dependencies: +assertRaises as a context manager should accept a 'msg' keyword 
argument.
nosy: +r.david.murray
priority: normal - low
stage: unit test needed - needs patch
versions: +Python 3.3 -Python 2.6, Python 3.1

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



[issue6027] test_xmlrpc_net fails when the ISP returns 302 Found

2010-12-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

IMO there's no way to fix this.  I suggest closing it as invalid, since the 
problem is a buggy ISP DNS server, and the problem only occurs when 
time.xmlrpc.com is down.

The canonical fix to problems like this is to remove dependency on the external 
service, but that would presumably defeat the entire purpose of 
test_xmlrpc_net.  So one fix would be to delete this test entirely.  Which if 
we have mock-server xmlrpc tests, might not be out of the question as a 
solution.  Note that the second test in that file tests against the xmlrpc 
interface of our buildbot master, and that support has been formally removed by 
upstream and only restored by us...presumably at some point we'll drop support 
for it too, when it breaks too badly to be easily forward ported.

Since there was, if I remember correctly, an extended period when xmlrpc.com's 
time service was down, simply deleting this test file may in fact be the best 
move.

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

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



[issue7198] Extraneous newlines with csv.writer on Windows

2010-12-26 Thread John Machin

John Machin sjmac...@users.sourceforge.net added the comment:

Skip, I'm WRITING, not reading.. Please read the 3.1 documentation for 
csv.writer. It does NOT mention newline='', and neither does the example. 
Please fix.

Other problems with the examples: (1) They encourage a bad habit (open inside 
the call to reader/writer); good practice is to retain the reference to the 
file handle (preferably with a with statement) so that it can be closed 
properly. (2) delimiter=' ' is very unrealistic.

The documentation for both 2.x and 3.x should be much more explicit about what 
is needed in open() for csv to work properly and portably:

2.x read: use mode='rb' -- otherwise fail on Windows
2.x write: use mode='wb' -- otherwise fail on Windows
3.x read: use newline='' -- otherwise fail unconditionally(?)
3.x write: use newline='' -- otherwise fail on Windows

The 2.7 documentation says If csvfile is a file object, it must be opened 
with the 'b' flag on platforms where that makes a difference ... in my 
experience, people are left asking what platforms? what difference?; Windows 
should be mentioned explicitly.

--
versions: +Python 2.7, Python 3.2, Python 3.3

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



[issue10769] ast: provide more useful range information

2010-12-26 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

I suggest you mail python-dev or python-ideas. I find it more consistent as it 
stands now.

--

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



[issue10769] ast: provide more useful range information

2010-12-26 Thread Sven Brauch

Sven Brauch svenbra...@googlemail.com added the comment:

Okay, thank you, I'm going to do that. :)

Bye,
Sven

--

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



[issue5258] addpackage in site.py fails hard on badly formed .pth files

2010-12-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Committed to py3k in r87497, 3.1 in r87499, and 2.7 in r87500.

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

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



[issue7198] Extraneous newlines with csv.writer on Windows

2010-12-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

OK, I'm reopening this as a doc issue, since currently the Python3 writer docs 
do not mention newline='', and it is indeed required on Windows.  John, would 
you care to suggest a doc patch?

I agree with Skip that where it makes a difference is more precise than 
specifically mentioning Windows, even if less useful in this context.  That is 
how the 'b' mode is documented in the open documentation.  To fix the problem 
with the CSV docs, the recommendation to use 'b' can simply be made 
unconditional, as it is for newline='' in python3.

--
components: +Documentation
nosy: +r.david.murray
resolution: invalid - 
stage:  - needs patch
status: closed - open
versions:  -Python 3.3

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



[issue10296] ctypes catches BreakPoint error on windows 32

2010-12-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

With a release build of python, I have a similar behavior on both 2.5 and 2.7; 
the messages are different though:
2.5: WindowsError: [Error -2147483645] One or more arguments are invalid.
2.7: WindowsError: exception: breakpoint encountered

And with both versions, a debug build (python_d.exe) triggers the JIT debugger. 
What do you get exactly?

--
nosy: +amaury.forgeotdarc

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



[issue10776] os.utime returns an error on NTFS-3G partition

2010-12-26 Thread Aaron Masover

New submission from Aaron Masover amaso...@gmail.com:

I'm working with Anki (http://ankisrs.net/) on a linux NTFS-3G partition. Anki 
requires access to modification times in order to handle its backup files. This 
works fine on my ext3 partition, but on an NTFS partition accessed with NTFS-3G 
an error is returned:

you...@yinghuochong:/storage/文件/anki/decks$ python -c 'import shutil,os; 
shutil.copyfile(u\u6f22\u5b57.anki, new.anki); os.utime(new.anki, None)'
you...@yinghuochong:/storage/文件/anki/decks$ python -c 'import shutil,os; 
shutil.copyfile(u\u6f22\u5b57.anki, new.anki); os.utime(new.anki, 
(1293402264,1293402264))'
Traceback (most recent call last):
  File string, line 1, in module
OSError: [Errno 1] Operation not permitted: 'new.anki'

Note that passing numbers into os.utime returns an error.

--
components: IO
messages: 124684
nosy: Aaron.Masover
priority: normal
severity: normal
status: open
title: os.utime returns an error on NTFS-3G partition
versions: Python 2.6

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



[issue9709] test_distutils warning: initfunc exported twice on Windows

2010-12-26 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Thorsten: my recommendation is to ignore this issue in your software. It's just 
a warning.

--

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



[issue10757] zipfile.write, arcname should be bytestring

2010-12-26 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

 So, in reverse of issue 4871, it appears that in this case the API should 
 reject bytes input with an appropriate error message.

-1. It is quite common to produce ill-formed zipfiles, and other
ziptools are interpreting them in violation of the format spec.
Python needs to support creation of such broken zipfiles,
even though it may not be able to read them back.

--

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



[issue10776] os.utime returns an error on NTFS-3G partition

2010-12-26 Thread Martin v . Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

Why do you think this is a bug in Python?

--
nosy: +loewis

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



[issue10777] xml.etree.register_namespace dictionary changed size during iteration

2010-12-26 Thread Peter

New submission from Peter p.j.a.c...@googlemail.com:

The following was found testing the Biopython unit tests (latest code from git) 
against Python 3.2 beta 2 (compiled from source on 64 bit Linux Ubuntu). 
Reduced test case:

$ python3.2
Python 3.2b2 (r32b2:87398, Dec 26 2010, 19:01:30) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 from xml.etree import ElementTree
 ElementTree.register_namespace(xs, http://www.w3.org/2001/XMLSchema;)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/peterjc/lib/python3.2/xml/etree/ElementTree.py, line 1071, in 
register_namespace
for k, v in _namespace_map.items():
RuntimeError: dictionary changed size during iteration


Suggested fix, replace this:

def register_namespace(prefix, uri):
if re.match(ns\d+$, prefix):
raise ValueError(Prefix format reserved for internal use)
for k, v in _namespace_map.items():
if k == uri or v == prefix:
del _namespace_map[k]
_namespace_map[uri] = prefix


with something like this:

def register_namespace(prefix, uri):
if re.match(ns\d+$, prefix):
raise ValueError(Prefix format reserved for internal use)
for k, v in list(_namespace_map.items()):
if k == uri or v == prefix:
del _namespace_map[k]
_namespace_map[uri] = prefix


Note that cElementTree seems to be OK.

Note that Python 3.1 was not affected as it didn't even have register_namespace,

$ python3
Python 3.1.2 (r312:79147, Sep 27 2010, 09:57:50) 
[GCC 4.4.3] on linux2
Type help, copyright, credits or license for more information.
 from xml.etree import ElementTree
 ElementTree.register_namespace(xs, http://www.w3.org/2001/XMLSchema;)
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'module' object has no attribute 'register_namespace'

--
components: XML
messages: 124688
nosy: maubp
priority: normal
severity: normal
status: open
title: xml.etree.register_namespace dictionary changed size during iteration
type: crash
versions: Python 3.2

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



[issue10776] os.utime returns an error on NTFS-3G partition

2010-12-26 Thread Aaron Masover

Aaron Masover amaso...@gmail.com added the comment:

The Anki author suggested that it was a python bug. However, that example 
command works on a drive set with different permissions, so this looks more 
like an NTFS-3G bug.

--
status: open - closed

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



[issue10757] zipfile.write, arcname should be allowed to be a byte string

2010-12-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

Well, this is the same 
treat-strings-and-byte-strings-equivalently-in-the-same-API problem that we've 
had elsewhere.  It'll require a bit of refactoring to make it work.

On read zipfile decodes filenames using cp437 if the utf-8 flag isn't set.  
Logically, then, a binary string should be encoded using cp437.  Since cp437 
has a character corresponding to each of the 256 bytes, it seems to me it 
should be enough to decode a binary filename using cp437 and set a flag that 
_encodeFilenameFlags would respect and re-encode to cp437 instead of utf-8.  
That might produce unexpected results if someone passes in a binary filename 
encoded in some other character set, but it would be consistent with how 
zipfiles work and so should be at least as interoperable as zipfiles normally 
are.

--
title: zipfile.write, arcname should be bytestring - zipfile.write, arcname 
should be allowed to be a byte string

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



[issue10764] sysconfig and alternative implementations

2010-12-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

PyPy has exactly the same issue. PyPy's workaround is to have a custom version 
of sysconfig.py, but this is really a hack.
If these config_vars are really determined at compile time, IMO they should be 
built in the interpreter (in a _sysconfig module?). This would even work on 
non-posix platforms.

--
nosy: +amaury.forgeotdarc

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



[issue9738] Document the encoding of functions bytes arguments of the C API

2010-12-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

r87504 documents encodings of error functions.
r87505 documents encodings of unicode functions.
r87506 documents encodings of AST, compiler, parser and PyRun functions.

--

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



[issue10778] decoding_fgets() (tokenizer.c) decodes the filename from the wrong encoding

2010-12-26 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

decoding_fgets() decodes the input filename from UTF-8 whereas the filename is 
encoded to the filesystem encoding. PyUnicode_DecodeFSDefault() should be used.

decoding_fgets() raises a SyntaxError(Non-UTF-8 code starting with '\xHH' in 
file xxx on line xxx, but no encoding declared; ...).

indenterror() (inconsistent use of tabs and spaces in indentation) and

--
components: Interpreter Core, Unicode
messages: 124693
nosy: haypo
priority: normal
severity: normal
status: open
title: decoding_fgets() (tokenizer.c) decodes the filename from the wrong 
encoding
versions: Python 3.2

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



[issue10779] Change filename encoding to FS encoding in PyErr_WarnExplicit()

2010-12-26 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

PyErr_WarnExplicit() expects a filename encoded to UTF-8. This function is only 
called twice in the Python interpreter: compiler_assert() (with assertion is 
always true, perhaps remove parentheses?) and symtable_warn() (eg. with name 
'xxx' is assigned to before global declaration), and both functions pass a 
filename encoded to the filesystem encoding.

PyErr_WarnExplicit() should use the filesystem encoding instead of UTF-8 to 
decode the filename. I already did the same change in issue #9713 and #10114 
(r85569).

Attached patch fixes this issue.

See also issue #10778 (decoding_fgets() (tokenizer.c) decodes the filename from 
the wrong encoding).

--
components: Interpreter Core, Unicode
files: warnexplicit_fsencoding.patch
keywords: patch
messages: 124694
nosy: haypo
priority: normal
severity: normal
status: open
title: Change filename encoding to FS encoding in PyErr_WarnExplicit()
versions: Python 3.2
Added file: http://bugs.python.org/file20170/warnexplicit_fsencoding.patch

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



[issue10778] decoding_fgets() (tokenizer.c) decodes the filename from the wrong encoding

2010-12-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

See also issue #10779 (Change filename encoding to FS encoding in 
PyErr_WarnExplicit()).

--

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



[issue9738] Document the encoding of functions bytes arguments of the C API

2010-12-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

While documenting encodings, I found two issues: #10778 and #10779.

--

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



[issue10780] Fix filename encoding in PyErr_SetFromWindowsErrWithFilename() (and PyErr_SetExcFromWindowsErrWithFilename())

2010-12-26 Thread STINNER Victor

New submission from STINNER Victor victor.stin...@haypocalc.com:

PyErr_SetFromWindowsErrWithFilename() expects a filename encoded to UTF-8. It 
is called by win32_error() function of the nt (posix) module, and win32_error() 
is called on an error in the bytes implementation of a function (if the 
argument is a byte string, not an Unicode string). But on Windows, bytes 
filenames are encoded to the ANSI code page, not to UTF-8.

PyErr_SetExcFromWindowsErrWithFilename() expects also a filename encoded to 
UTF-8. It is not used in Python core, but I think that it should be fixed too.

See also #10779 (and #9713 and #10114).

--
components: Interpreter Core, Unicode, Windows
messages: 124697
nosy: haypo
priority: normal
severity: normal
status: open
title: Fix filename encoding in PyErr_SetFromWindowsErrWithFilename() (and 
PyErr_SetExcFromWindowsErrWithFilename())
versions: Python 3.2

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



[issue10576] Add a progress callback to gcmodule

2010-12-26 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

1) what I mean is that if a callback rejects GC, the GC algorithm may find its 
condition for invoking GC in the first place to be still valid immediately 
afterwards, so doing a GC will be immediately retried.  I have to check, but it 
could mean that more changes would be required.
2) Of course callbacks have to know, e.g. those that intend to gather 
statisctic or measure the time of GC.  They have started a timer on the start 
opcode, and expect a stop code to follow.  They have to get some canceled 
code for their bookkeeping to work.

Then additionally we have the question: Should you be able to cancel a direct 
gc request (like calling gc.collect()) or just the automatic one?

This then starts to be a much more complicated change, perhaps one that 
requires a PEP so I don't think we should do all of that in one gulp.  Once the 
callback mechanism is in, there is every oppertunity to extend it.

--

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



[issue10780] Fix filename encoding in PyErr_SetFromWindowsErrWithFilename() (and PyErr_SetExcFromWindowsErrWithFilename())

2010-12-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

issue10780.patch fixes this issue.

--
keywords: +patch
Added file: http://bugs.python.org/file20171/issue10780.patch

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



[issue10296] ctypes catches BreakPoint error on windows 32

2010-12-26 Thread Kristján Valur Jónsson

Kristján Valur Jónsson krist...@ccpgames.com added the comment:

I _think_ that in our old 2.5 python (which had a backported ctypes from 2.6 to 
support 64 bits) we always got the JIT debugger i.e. with _ctypes.pyd and 
_ctypes_d.pyd.

This api, DebugBreak always invokes the JIT debugger, however the program was 
compiled (_NDEBUG, DEBUG, or not).
This is done by raising the breakpoint exception and apparently _ctypes.pyd is 
catching that exception and handling it, but only in release mode, while I 
think it shouldn't do.

--

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



[issue10780] Fix filename encoding in PyErr_SetFromWindowsErrWithFilename() (and PyErr_SetExcFromWindowsErrWithFilename())

2010-12-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

issue10780_mbcs_ignore.patch is a safer but more complex fix: use mbcs decoder 
with the ignore error handler. Even if issue10780.patch might raise a 
UnicodeDecodeError, I prefer it because it's shorter, simpler and so easier to 
maintain the code.

--
Added file: http://bugs.python.org/file20172/issue10780_mbcs_ignore.patch

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



[issue5871] email.header.Header too lax with embeded newlines

2010-12-26 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

I've considered this a bit more deeply, and it turns out to be simpler to fix 
than I originally thought, assuming the fix is acceptable.

When a message is parsed we obviously wind up with headers that don't have any 
embedding issues.  So, if we check for embedded headers at message production 
time and reject them, we can't be breaking any round-trip properties of the 
package.  The only way for a header malformed in this way to get produced is 
through it being added to a Message object via one of the header adding APIs.  
Further, for this specific issue we are only worried about things that look 
like header labels that follow a newline and don't have whitespace in front of 
them.  We don't have to worry about the other RFC restrictions on headers in 
order to fix this.

I tried a patch that checked at header add time, and while that is potentially 
workable it got fairly complicated and is a bit fragile (did I get *all* the 
places a header can be added?)  Instead, the attached patch takes the approach 
of throwing an error for an embedded header at message serialization time.  The 
advantage here is that all headers are run through Header.encode on 
serialization, so there's only one bit of code that needs to be modified to 
pretty much guarantee that header injection can't happen.

There are code paths for producing individual headers that don't go through 
encode, but these don't produce complete messages, so it shouldn't be a problem 
(and may even be a feature).

Barry, do you think this is indeed enough of a security issue that this fix (if 
acceptable) should be backported to 2.6?

I should note that this patch produces a situation unusual[*] for the email 
package, where serialization may throw an error (but only on a Message object 
that has been modified).  Also, I'm reusing HeaderParseError, which may not be 
optimal, although it does seem at least semi-logical.

[*] Generator currently only throws an error itself in one place, if it 
encounters a bytes payload for a text Message.  Again, something that can only 
happen in a modified Message, so this seems analogous.

--
keywords: +patch
stage: unit test needed - patch review
versions: +Python 2.7, Python 3.1
Added file: http://bugs.python.org/file20173/header_injection.diff

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



[issue10778] decoding_fgets() (tokenizer.c) decodes the filename from the wrong encoding

2010-12-26 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Oh, ignore indenterror() (inconsistent use of tabs and spaces in indentation) 
and, I forgot to remove it. indenterror() is correct.

--

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



[issue10573] Consistency in unittest assert methods: order of actual, expected

2010-12-26 Thread Ron Adam

Ron Adam ron_a...@users.sourceforge.net added the comment:

The issue10573.diff file with the time stamp 20:03 has a lot of document 
changes that don't have corresponding code changes?

--
nosy: +ron_adam

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



[issue10576] Add a progress callback to gcmodule

2010-12-26 Thread Lukas Lueg

Lukas Lueg lukas.l...@gmail.com added the comment:

Agreed, let's have the simple callback first.

To solve 2) later on, we could have the callback proposed here be the 
'execution'-callback. It neither has nor will have the capability to prevent 
garbage-collection.
We can introduce another 'prepare'-callback later which is called when the 
gc-modules decides that it is time for collection. Callbacks may react with a 
negative value so execution does not happen and the execution-callbacks are 
also never called.

--

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