[issue8620] wrong truncation of last line in cmd.Cmd

2010-08-02 Thread Mattelaer

Mattelaer  added the comment:

Thanks a lot for the fix.
On 02-août-10, at 01:58, R. David Murray wrote:

>
> R. David Murray  added the comment:
>
> Thanks, Éric. Fixed.
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue6858] This is a python file, apply syntax highlighting

2010-08-02 Thread Tal Einat

Tal Einat  added the comment:

I think we are in agreement :)

Regarding the warning message, I was referring only to the case that the syntax 
highlighter fails completely and raises an exception. I'm not even sure if that 
can happen, but in case it does an informative message would be better than 
just not highlighting, and much better than IDLE dying. I'm bringing this up in 
this context because IMO if we allow highlighting of arbitrary files, we should 
at least ensure that this doesn't crash IDLE if the highlighting does fail.

--

___
Python tracker 

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



[issue8688] distutils sdist is too laze w.r.t. recalculating MANIFEST

2010-08-02 Thread Dirkjan Ochtman

Changes by Dirkjan Ochtman :


--
nosy: +djc

___
Python tracker 

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



[issue8612] multiprocessing Queue module failes to send INIConfig objects

2010-08-02 Thread Zaar Hai

Zaar Hai  added the comment:

Exactly.
Thank you.

On Mon, Aug 2, 2010 at 1:59 AM, Georg Brandl  wrote:
>
> Georg Brandl  added the comment:
>
> The issue in the iniparse tracker has been closed as "fixed" now, so I assume 
> the problem was on that side.
>
> --
> nosy: +georg.brandl
> resolution:  -> works for me
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Note that pickle deliberately does not support serializing code objects. 

This is a security feature and should not be broken !

If you need to pickle such objects, you can easily register handlers that take 
care of this.

--
nosy: +lemburg

___
Python tracker 

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



[issue9452] configparser support for reading from strings and dictionaries

2010-08-02 Thread Łukasz Langa

Łukasz Langa  added the comment:

Good questions, thanks! The answers will come useful for documentation and 
later hype :)



READING CONFIGURATION FROM A DATA STRUCTURE
---

This is all about templating a decent set of default values. The major use case 
I'm using this for (with a homebrew SafeConfigParser subclass at the moment) is 
to provide *in one place* a set of defaults for the whole configuration. The 
so-called `defaults=` that we have at the moment don't fit this space well 
enough because they provide values that can (and will) jump into every section. 
This made them useless for me twice:
- when configuring access to external components in a fairly complex system; 
abstracting out the useless details the template I was looking for was

[name-server]
port=
protocol=
verbose=

[workflow-manager]
port=
protocol=
verbose=

[legacy-integration]
port=
protocol=
verbose=

# there were about 15 of these

- second case was a legacy CSV translation system (don't ask!). An abstract of 
a config with conflicting keys:

[company1-report]
delimiter=,
amount_column=
amount_type=
description_column=
description_type=
ignore_first_line=True

[company2-report]
delimiter=;
amount_column=
amount_type=
description_column=
description_type=
ignore_first_line=False

# and so on for ~10 entries

As you can see, in both examples `defaults=` couldn't be a good enough 
template. The reason I wanted these default values to be specified in the 
program was two-fold:

1. to be able to use the configuration without worrying about NoOptionErrors or 
fallback values on each get() invocation

2. to handle customers with existing configuration files which didn't include 
specific sections; if they didn't need customization they could simply use the 
defaults provided

I personally like the dictionary reading method but this is a matter of taste. 
Plus, .fromstring() is already used in unit tests :)



DUPLICATE OPTION VALIDATION
---

Firstly, I'd like to stress that this validation does NOT mean that we cannot 
update keys once they appear in configuration. Duplicate option detection works 
only while parsing a single file, string or dictionary. In this case duplicates 
are a configuration error and should be notified to the user.

You are right that for a programmer accepting the last value provided is 
acceptable. In this case the impact should be on the user who might not feel 
the same. If his configuration is ambiguous, it's best to use the Zen: "In the 
face of ambiguity, refuse the temptation to guess."

This is very much the case for large configuration files (take 
/etc/ssh/sshd_config or any real life ftpd config, etc.) when users might miss 
the fact that one option is uncommented in the body or thrown in at the end of 
the file by another admin or even the user himself.

Users might also be unaware of the case-insensitivity. 

These two problems are even more likely to cause headaches for the dictionary 
reading algorithm where there actually isn't an order in the keys within a 
section and you can specify a couple of values that represent the same key 
because of the case-insensitivity. Plus, this is going to be even more visible 
once we introduce mapping protocol access when you can add a whole section with 
keys using the dictionary syntax.

Another argument is that there is already section duplicate validation but it 
doesn't work when reading from files. This means that the user might add two 
sections of the same name with contradicting options.



SUMMARY
---
Reading from strings or dictionaries provides an additional way to feed the 
parser with values. Judging from the light complexity of both methods I would 
argue that it's beneficial to configparser users to have well factored unit 
tested methods for these tasks so they don't have to reimplement them over and 
over again when the need arises.

In terms of validation, after you remark and thinking about it for a while, I 
think that the best path may be to let programmers choose during parser 
initialization whether they want validation or not. This would be also a good 
place to include section duplicate validation during file reading. Should I 
provide an updated patch?

After a couple of years of experience with external customers configuring 
software I find it better for the software to aid me in customer support. This 
is the best solution when users can help themselves. And customers (and we 
ourselves, too!) do stupid things all the time. And so, specifying a default 
set of sane values AND checking for duplicates within the same section helps 
with that.

--

___
Python tracker 

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



[issue588756] python should obey the FHS

2010-08-02 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +barry

___
Python tracker 

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



[issue818201] distutils: clean does not use build_base option from build

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

Sorry for the long delay without reply. Thank you for the report, I’ll look 
into it in the following weeks. In distutils2, I think clean could use the 
configure command (#8254) or maybe it’ll be simpler to just 
set_undefined_options from build. I’ll ask Tarek whether we can backport this 
to distutils after it’s done.

--
assignee: tarek -> merwok
components: +Distutils2 -Distutils
resolution:  -> accepted
versions: +Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue2377] Replace import.c with a pure Python implementation

2010-08-02 Thread Éric Araujo

Changes by Éric Araujo :


--
versions: +Python 3.2 -Python 3.1

___
Python tracker 

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



[issue4636] bdist_wininst installer with install script raises exception

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

Can you still reproduce in 3.1 and 3.2?

--
nosy: +merwok

___
Python tracker 

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



[issue2945] bdist_rpm does not list dist files (should effect upload)

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

Tarek, can this bug be fixed or is it outdated? IOW, is bdist_rpm officially 
discouraged or do you still accept bugfixes for it?

--
nosy: +merwok
versions: +Python 3.2

___
Python tracker 

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



[issue763043] unable to specify another compiler

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

The bug has been fixed in 2.3, apparently it’s a doc bug now, so reassigning.

--
assignee: tarek -> d...@python
nosy: +d...@python, merwok
versions: +Python 3.2

___
Python tracker 

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



[issue8821] Range check on unicode repr

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Antoine Pitrou wrote:
> 
> Antoine Pitrou  added the comment:
> 
> Well, the patch was technically useless since, as mentioned, unicode strings 
> are terminated by a NUL character by design.

There are two things to keep in mind:

 * Unicode objects are NUL-terminated, but only very external APIs
   rely on this (e.g. code using the Windows Unicode API). Please
   don't make the code in unicodeobject.c itself rely on this
   subtle detail.

 * The codecs work on Py_UNICODE* buffers which are *never* guaranteed
   to be NUL-terminated, so the problem in question is real.

> Anyway, I now get the following error on the 2.7 branch. Perhaps it's related:
> 
> ==
> FAIL: test_ucs4 (test.test_unicode.UnicodeTest)
> --
> Traceback (most recent call last):
>   File "/home/antoine/cpython/27/Lib/test/test_unicode.py", line 941, in 
> test_ucs4
> self.assertEqual(x, y)
> AssertionError: '\\udbc0\\udc00' != '\\U0010'
> 
> --
> nosy: +pitrou
> status: closed -> open
> 
> ___
> Python tracker 
> 
> ___
> ___
> Python-bugs-list mailing list
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-bugs-list/mal%40egenix.com

--
nosy: +lemburg

___
Python tracker 

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



[issue8821] Range check on unicode repr

2010-08-02 Thread Marc-Andre Lemburg

Changes by Marc-Andre Lemburg :


--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue7219] Unhelpful error message when a distutils package install fails due to a permissions error

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

Could you run ipy.exe setup.py build, then set DISTUTILS_DEBUG in the 
environment and run ipy.exe
setup.py install?

--
nosy: +merwok

___
Python tracker 

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



[issue1644987] ./configure --prefix=/ breaks, won't build C modules

2010-08-02 Thread Éric Araujo

Changes by Éric Araujo :


--
assignee:  -> tarek
components: +Distutils
nosy: +merwok, tarek

___
Python tracker 

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



[issue1436203] getpass.getpass() should allow Unicode prompts

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

I agree with Victor. Use 3.1 if you don’t depend on unported libraries, else 
explicitly encode with sys.stdout.encoding or set PYTHONIOENCODING in the 
environment.

--
resolution:  -> out of date
stage: unit test needed -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue3984] python interpreter import dependency with disutils/util

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

get_config has moved to sysconfig, which is now a top-level module, and site is 
fixed.

--
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue1180267] expanding platform module and making it work as it should

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

You appear to be requesting two things:

 1. Determine the Windows version by looking at sys.getwindowsversion() rather 
than relying on the ver command line tool.

 2. Use lsb_release to fetch the release name on Linux systems that support it.

The first is possible, if that API is available. It would still have to fall 
back to the ver command line tool, since it's not future-proof, i.e. future 
versions of Windows will not automatically be supported.

The second is wrong, since platform.release() is only a short-cut to the 
uname() function and this refers to the underlying system rather than the Linux 
distrubtion.

However, I could add support for lsb_release to the linux_distribution() 
function.

--

___
Python tracker 

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



[issue7299] setup.py install doesn't honor PYTHONUSERBASE

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

Closing in two weeks if there is no additional information. Please reopen if 
needed.

--
status: open -> pending

___
Python tracker 

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



[issue9106] remove numbers from 3-.. level entries in docs toc

2010-08-02 Thread Éric Araujo

Éric Araujo  added the comment:

(Rationale for this resolution: On #3143, it was used to remind us to change a 
setting in Doc/conf.py after the switch to a new version of Sphinx with the new 
feature.)

--
resolution: invalid -> remind

___
Python tracker 

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



[issue870479] Scripts need platform-dependent handling

2010-08-02 Thread Éric Araujo

Changes by Éric Araujo :


--
dependencies: +Make installed scripts executable on windows

___
Python tracker 

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



[issue8821] Range check on unicode repr

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

>  * Unicode objects are NUL-terminated, but only very external APIs
>rely on this (e.g. code using the Windows Unicode API). Please
>don't make the code in unicodeobject.c itself rely on this
>subtle detail.

That's wishful thinking, don't you think? *I* am not making code in
unicodeobject.c rely on this. It has been so for years, long before I
was here. You should check who made that design decision in the first
place instead of putting the blame on me.

Besides, the fact that external APIs rely on it make it much more
unchangeable than if it were an implementation detail.

--

___
Python tracker 

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



[issue8821] Range check on unicode repr

2010-08-02 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue9453] pulldom.SAX2DOM Doesn't support processing instructions before the root element

2010-08-02 Thread Mark Smith

New submission from Mark Smith :

pulldom.SAX2DOM raises a TypeError if it encounters a processing instruction 
before the root element of an XML document.

It is valid to have a processing instruction before the root node of a document 
(and SAX2DOM's superclass, PullDOM supports this), so this behaviour is invalid.

I've encountered this bug while writing unit tests for pulldom (#9373), so I've 
added this as an @expectedFailure, to be submitted as a patch for that ticket.

--
components: XML
messages: 112442
nosy: mark.smith
priority: normal
severity: normal
status: open
title: pulldom.SAX2DOM Doesn't support processing instructions before the root 
element
type: behavior
versions: Python 3.2

___
Python tracker 

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



[issue9453] pulldom.SAX2DOM Doesn't support processing instructions before the root element

2010-08-02 Thread Mark Smith

Mark Smith  added the comment:

My recommendation is that SAX2DOM is deprecated and removed from the standard 
library rather than fixing this issue. The class is currently undocumented, has 
weird behaviour, and is unused within the Python standard library, so I don't 
expect that this will cause undue pain.

--

___
Python tracker 

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



[issue1553375] Add traceback.print_full_exception()

2010-08-02 Thread Ray.Allen

Ray.Allen  added the comment:

David Murray, where is the patch?

--
nosy: +ysj.ray

___
Python tracker 

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



[issue9444] argparse does not honor prefix_chars when adding default options

2010-08-02 Thread Doug Hellmann

Doug Hellmann  added the comment:

Yes, that doc change  is clear.  Thanks!

--
nosy: +ted.turocy

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

> This is a security feature and should not be broken !

Can you explain this?

I don't think I agree, since an attacker can always serialize whatever they 
feel like.  It's the person doing the deserialization that has to be careful.

--

___
Python tracker 

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



[issue8821] Range check on unicode repr

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Antoine Pitrou wrote:
> 
> Antoine Pitrou  added the comment:
> 
>>  * Unicode objects are NUL-terminated, but only very external APIs
>>rely on this (e.g. code using the Windows Unicode API). Please
>>don't make the code in unicodeobject.c itself rely on this
>>subtle detail.
> 
> That's wishful thinking, don't you think? *I* am not making code in
> unicodeobject.c rely on this. It has been so for years, long before I
> was here. You should check who made that design decision in the first
> place instead of putting the blame on me.

I'm not blaming you for this. However, I don't want more code
to rely on this behavior.

The NUL-termination has never been documented and my decision
to use NUL-termination on the PyUnicodeObject buffers was merely
a safety measure.

> Besides, the fact that external APIs rely on it make it much more
> unchangeable than if it were an implementation detail.

It's an undocumented implementation detail. We can certainly
deprecate it's use using the standard approach we have for this.

But all that is off-topic for this ticket, since codecs
operate on Py_UNICODE* buffers together with a size parameter
and relying on those buffers being NUL-terminated is bound to
cause problems.

--

___
Python tracker 

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



[issue9209] pstats module crashes on trailing backslash

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Thanks, fixed in r83523.

--
nosy: +georg.brandl
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue7781] interactive pstats broken

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Thanks, fixed in r83523.

--
nosy: +georg.brandl
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Jean-Paul Calderone wrote:
> 
> Jean-Paul Calderone  added the comment:
> 
>> This is a security feature and should not be broken !
> 
> Can you explain this?
> 
> I don't think I agree, since an attacker can always serialize whatever they 
> feel like.  It's the person doing the deserialization that has to be careful.

The marshal protocol which is used for storing PYC files has support
for serializing code objects.

The support on pickles, which are meant for data serialization, was not added
per default to prevent unwanted code execution during deserialization,
but instead made possible via pickle hooks, so as to make the decision
to support code serialization an explicit application choice.

By adding default support for unpickling code objects, you can trick
the unpickling code into executing serialized code: first you add
a serialized version of a malicious class definition, then you add
an object of that class to the pickle. At object restore time, the
malicious class can then run os.system('rm -rf /')...

--

___
Python tracker 

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



[issue8572] httplib getheader() throws error instead of default

2010-08-02 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

Fixed in revision 83521 (py3k) and 83522 (release31-maint).
I made slight modifications to the patch to include non-iterable values,like 
int, for default too.

If you feel the documentation could be made better, please suggest the wordings 
for the sentence. I am leaving the bug open for this, if the current one is 
fine, we can close the bug.

David (RDM): I am not sure if we need a Deprecation Warning here.
If you actually see getheader() is supposed to return a string only as Headers 
are strings. I don't think someone should be consciously passing a list of 
items and excepting the list of items back.

', '.join of header values seem to be for situations in which get_all returns 
list of values, which is possible when there are different values for same 
header key.  This is a correct behavior IMO. The 2.x one is a mistake where it 
returned only the first value as a string.

--
priority: release blocker -> 
resolution:  -> fixed
stage: unit test needed -> committed/rejected

___
Python tracker 

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



[issue9428] profile.py bug with the main file being profiled

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Fixed (also for cProfile) in r83524.

--
nosy: +georg.brandl
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

> By adding default support for unpickling code objects, you can trick
the unpickling code into executing serialized code:

This doesn't sound correct to me.

You can *already* trick unpickling code into executing serialized code.  You 
don't need this feature in order to be able to do it.

--

___
Python tracker 

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



[issue8821] Range check on unicode repr

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> But all that is off-topic for this ticket, since codecs
> operate on Py_UNICODE* buffers together with a size parameter
> and relying on those buffers being NUL-terminated is bound to
> cause problems.

That's right. Then perhaps a fixed patch can be uploaded, if someone
cares enough.

--

___
Python tracker 

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



[issue6436] trace module doesn't seem to produce .cover files for Py3 (but does for Py2)

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Duplicate of #1690103.

--
nosy: +georg.brandl
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue7563] yield in except clause causes exception context to be lost

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

This won't get backported now that 2.7 is in maintenance.

--
nosy: +georg.brandl
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue9454] unittest.expectedFailure decorator does not maintain target function's docstring.

2010-08-02 Thread Mark Smith

New submission from Mark Smith :

When running tests with -v, the test runner prints out the docstring of each 
test method, if present, and falls back to the method name if it's not present.

Test methods wrapped with @expectedFailure do not print out their docstring, so 
it looks like the docstring is not copied to the wrapper function.

Failing test coming soon, hopefully followed by a patch to fix :)

--
components: Tests
messages: 112457
nosy: mark.smith
priority: normal
severity: normal
status: open
title: unittest.expectedFailure decorator does not maintain target function's 
docstring.
type: performance
versions: Python 3.2

___
Python tracker 

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



[issue3821] trace module bug when using --missing

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Fixed the test cases and committed them in r83527.

--
nosy: +georg.brandl
status: open -> closed

___
Python tracker 

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



[issue9454] unittest.expectedFailure decorator does not maintain target function's docstring.

2010-08-02 Thread Mark Smith

Mark Smith  added the comment:

Provided a patch to demonstrate this issue.

Demonstrates that docstrings aren't copied to the decorator function.

--
keywords: +patch
Added file: http://bugs.python.org/file18321/unittest_failing_test.patch

___
Python tracker 

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



[issue8821] Range check on unicode repr

2010-08-02 Thread Matt Giuca

Matt Giuca  added the comment:

OK, I finally had time to review this issue again.

Firstly, granted the original fix broke a test case, shouldn't we figure out 
why it broke and fix it, rather than just revert the change and continue 
relying on this tenuous assumption? Surely it's best to have as little code 
relying on it as possible.

Secondly, please have a look at my patch again. It wasn't committed properly -- 
no offense to Georg, it's an honest mistake! My patch was:

--- Objects/unicodeobject.c (revision 81539)
+++ Objects/unicodeobject.c (working copy)
@@ -3065,7 +3065,7 @@
 }
 #else
 /* Map UTF-16 surrogate pairs to '\U00xx' */
-else if (ch >= 0xD800 && ch < 0xDC00) {
+else if (ch >= 0xD800 && ch < 0xDC00 && size > 0) {
 Py_UNICODE ch2;
 Py_UCS4 ucs;

The commit made in r83418 by Georg Brandl (and similarly r83395 in py3k):
http://svn.python.org/view/python/branches/release27-maint/Objects/unicodeobject.c?r1=82980&r2=83418

--- Objects/unicodeobject.c (revision 83417)
+++ Objects/unicodeobject.c (revision 83418)
@@ -3067,7 +3067,7 @@
 
 ch2 = *s++;
 size--;
-if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+if (ch2 >= 0xDC00 && ch2 <= 0xDFFF && size) {
 ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x0001;
 *p++ = '\\';
 *p++ = 'U';
@@ -3316,7 +3316,7 @@
 
 ch2 = *s++;
 size--;
-if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+if (ch2 >= 0xDC00 && ch2 <= 0xDFFF && size) {
 ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 
0x0001;
 *p++ = '\\';
 *p++ = 'U';

I put the size check on the first character of the surrogate pair; in the 
committed version the size check was on the second character (after the "size" 
variable is decremented), causing it to break out of that branch too early in 
some cases.

Moving the size check to the outer if block fixes the test breakage.

PS. Good find on the second copy of that code in the 
PyUnicode_EncodeRawUnicodeEscape function. I've attached a new patch which 
fixes both functions instead of just the unicodeescape_string function.

Passes all test cases on UCS2 build of the 2.7 branch.

--
Added file: http://bugs.python.org/file18322/unicode-range-check2.patch

___
Python tracker 

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



[issue9454] unittest.expectedFailure decorator does not maintain target function's docstring.

2010-08-02 Thread Mark Smith

Changes by Mark Smith :


Removed file: http://bugs.python.org/file18321/unittest_failing_test.patch

___
Python tracker 

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



[issue9454] unittest.expectedFailure decorator does not maintain target function's docstring.

2010-08-02 Thread Mark Smith

Mark Smith  added the comment:

Removed the failing test patch, because it didn't demonstrate what I thought it 
did. Unwrapped tests also don't have docstrings, because they are instances of 
the TestCase, not references to the function.

--

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Jean-Paul Calderone wrote:
> 
> Jean-Paul Calderone  added the comment:
> 
>> By adding default support for unpickling code objects, you can trick
> the unpickling code into executing serialized code:
> 
> This doesn't sound correct to me.
> 
> You can *already* trick unpickling code into executing serialized code.  You 
> don't need this feature in order to be able to do it.

How ?

--

___
Python tracker 

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



[issue1553375] Add traceback.print_full_exception()

2010-08-02 Thread R. David Murray

R. David Murray  added the comment:

Morning does make a difference.  Revised patch that also works at the top level 
of a module.  (Let's see if I can manage to actually attach it this time...)

--
keywords: +patch
Added file: http://bugs.python.org/file18323/full_traceback.patch

___
Python tracker 

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



[issue8959] WINFUNCTYPE wrapped ctypes callbacks not functioning correctly in Python 2.7

2010-08-02 Thread Brian Curtin

Brian Curtin  added the comment:

The test added here is crashing my Windows 7 x64 machine on py3k in debug mode. 
It hangs indefinitely in release mode. This isn't occurring with the 
buildbots...


(Sorry for not reporting this sooner...I came to see the status and apparently 
the message I thought I left was not here, so, no status)

--
nosy: +brian.curtin, georg.brandl
status: closed -> open

___
Python tracker 

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



[issue9454] unittest.expectedFailure decorator does not maintain target function's docstring.

2010-08-02 Thread Mark Smith

Mark Smith  added the comment:

Closed this issue. The initial report was in error -- it turns out I can't even 
read my own console. I'm an idiot :)

--
status: open -> closed

___
Python tracker 

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



[issue1581182] Definition of a "character" is wrong

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Without patch, I don't see how this issue can be moved forward.

Adding a list of such Unicode term definitions would at best cause additional 
confusion and only address people knowledgable in the Unicode field.

Note that Python's use of code units and code points matches those of the 
Unicode standard in most respects. Glyphs and all higher-level definitions are 
out-of-scope for Python.

--
status: open -> languishing

___
Python tracker 

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



[issue1581182] Definition of a "character" is wrong

2010-08-02 Thread Éric Araujo

Changes by Éric Araujo :


--
assignee:  -> d...@python
nosy: +d...@python
stage:  -> needs patch
versions: +Python 2.6, Python 3.2

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

For example:

exar...@boson:~$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class x(object):
... def __reduce__(self):
... import os
... return os.system, ('echo "Hello from sploitland"',)
... 
>>> import pickle
>>> pickle.loads(pickle.dumps(x()))
Hello from sploitland
0
>>>

--

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Mon, Aug 2, 2010 at 9:25 AM, Marc-Andre Lemburg
 wrote:
..
>> You can *already* trick unpickling code into executing serialized code.  You 
>> don't need
> this feature in order to be able to do it.
>
> How ?
>
>>> from pickle import *
>>> class evil:
...def __reduce__(self):
...return (exec, ("print('pwned!')",))
...
>>> s = dumps(evil())
>>> loads(s)
pwned!

See also http://bugs.python.org/issue9120#msg109004 .

AFAICT, the reason functions and classes are pickled by name has
nothing to do with security. From the manual:

"""Similarly, when class instances are pickled, their class’s code and
data are not pickled along with them. Only the instance data are
pickled. This is done on purpose, so you can fix bugs in a class or
add methods to the class and still load objects that were created with
an earlier version of the class. If you plan to have long-lived
objects that will see many versions of a class, it may be worthwhile
to put a version number in the objects so that suitable conversions
can be made by the class’s __setstate__() method.
"""  
http://docs.python.org/library/pickle.html?#what-can-be-pickled-and-unpickled

--

___
Python tracker 

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



[issue8572] httplib getheader() throws error instead of default

2010-08-02 Thread R. David Murray

R. David Murray  added the comment:

Right, the join behavior is correct.  But the definition of a *default* (aka 
sentinel) value is that it is returned *unchanged*.  It is counter intuitive 
that if you pass a list of strings as a default, that what you get back is 
those strings joined by ','.  But that is the released behavior. so we have to 
live with it.

I think the doc patch is OK except that it should be 'iterable' rather than 
'iterator'.  However, it might make the whole method clearer if we say instead:

Return the value of the header *name*, or *default* if there is no header 
matching *name*.  If there is more than one header with the name *name*, return 
all of the values joined by ', '.  If 'default' is any iterable other than a 
single string, its elements are similarly returned joined by commas.

--
priority:  -> normal

___
Python tracker 

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



[issue9454] unittest.expectedFailure decorator does not maintain target function's docstring.

2010-08-02 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +michael.foord

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +alexandre.vassalotti, pitrou

___
Python tracker 

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



[issue9454] unittest.expectedFailure decorator does not maintain target function's docstring.

2010-08-02 Thread R. David Murray

R. David Murray  added the comment:

Woops, sorry for making you nosy on a closed issue, Michael.  Apparently I 
can't read either.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Jean-Paul Calderone wrote:
> 
> Jean-Paul Calderone  added the comment:
> 
> For example:
> 
> exar...@boson:~$ python
> Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
> [GCC 4.4.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 class x(object):
> ... def __reduce__(self):
> ... import os
> ... return os.system, ('echo "Hello from sploitland"',)
> ... 
 import pickle
 pickle.loads(pickle.dumps(x()))
> Hello from sploitland
> 0

But here you are not transferring malicious code in the pickle
string, you are just triggering the execution of such code that
you already have (and are in control of).

Without the definition of class x on the receiving side, there
would be no exploit.

By adding support for pickling code objects, you'd make it possible
to place the definition of class x into the pickle string and
you would no longer be in control of that code.

--

___
Python tracker 

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



[issue9444] argparse does not honor prefix_chars when adding default options

2010-08-02 Thread Catherine Devlin

Catherine Devlin  added the comment:

Attached a unit test patch corresponding to Ted's patch.  
http://bugs.python.org/file18320/argparse_test.patch

--
nosy: +catherine

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Mon, Aug 2, 2010 at 10:05 AM, Marc-Andre Lemburg
 wrote:
..
> Without the definition of class x on the receiving side, there
> would be no exploit.

You are mistaken.  Try adding del x (or del evil in my example)
between dumps and loads and see it working.

--

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I think methods should be picklable just like global functions are, that is, by 
pickling a tuple of the fully-qualified class name ("mymodule.myclass"), method 
name ("mymethod"), and self.

--

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

M.-A. Lemburg wrote:
> Jean-Paul Calderone wrote:
>>
>> Jean-Paul Calderone  added the comment:
>>
>> For example:
>>
>> exar...@boson:~$ python
>> Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
>> [GCC 4.4.1] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
> class x(object):
>> ... def __reduce__(self):
>> ... import os
>> ... return os.system, ('echo "Hello from sploitland"',)
>> ... 
> import pickle
> pickle.loads(pickle.dumps(x()))
>> Hello from sploitland
>> 0
> 
> But here you are not transferring malicious code in the pickle
> string, you are just triggering the execution of such code that
> you already have (and are in control of).
> 
> Without the definition of class x on the receiving side, there
> would be no exploit.
> 
> By adding support for pickling code objects, you'd make it possible
> to place the definition of class x into the pickle string and
> you would no longer be in control of that code.

Hmm, I just tried the code and it seems that you're right:

The pickle string does not contain a reference to class x,
but only the name of the function to call. Wow, that's a huge
hole in Python's pickle system...

...  def __reduce__(self):
...   import os
...   return os.system, ('echo "Bingo"',)
...
>>> import pickle
>>> pickle.dumps(C())
'cposix\nsystem\np0\n(S\'echo "Bingo"\'\np1\ntp2\nRp3\n.'
>>> C = None
>>> s = 'cposix\nsystem\np0\n(S\'echo "Bingo"\'\np1\ntp2\nRp3\n.'
>>> pickle.loads(s)
Bingo
0

--

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Mon, Aug 2, 2010 at 10:11 AM, Marc-Andre Lemburg
 wrote:
..
> Hmm, I just tried the code and it seems that you're right:
>
> The pickle string does not contain a reference to class x,
> but only the name of the function to call. Wow, that's a huge
> hole in Python's pickle system...

That's why we have a big red

"""
Warning: The pickle module is not intended to be secure against
erroneous or maliciously constructed data. Never unpickle data
received from an untrusted or unauthenticated source.
"""

in the docs.

--

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Alexander Belopolsky wrote:
> 
> Alexander Belopolsky  added the comment:
> 
> On Mon, Aug 2, 2010 at 10:11 AM, Marc-Andre Lemburg
>  wrote:
> ..
>> Hmm, I just tried the code and it seems that you're right:
>>
>> The pickle string does not contain a reference to class x,
>> but only the name of the function to call. Wow, that's a huge
>> hole in Python's pickle system...
> 
> That's why we have a big red
> 
> """
> Warning: The pickle module is not intended to be secure against
> erroneous or maliciously constructed data. Never unpickle data
> received from an untrusted or unauthenticated source.
> """
> 
> in the docs.

Good :-)

I've never used .__reduce__() and wasn't aware of the
fact that it can be used to run arbitrary code without
relying on the defining class.

I also like Antoine's idea of pickling the function/method name
instead of the whole code object.

This is in line with PEP 307 (http://www.python.org/dev/peps/pep-0307/)
which already uses the approach for classic class objects, Python
functions, etc.

--

___
Python tracker 

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



[issue6074] .pyc files created readonly if .py file is readonly, python won't overwrite

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Apparently this may have become Windows-specific at some point. I can't 
reproduce under Linux with Python 2.6.5, 2.7 or 3.2.

I get a strange warning with -v under 2.7, though:

$ touch b.py && ~/cpython/27/python -v a.py 2>&1 | grep b.py
# /home/antoine/py3k/__svn__/b.pyc has bad mtime
import b # from /home/antoine/py3k/__svn__/b.py
# wrote /home/antoine/py3k/__svn__/b.pyc

("bad mtime"??)

--
components: +Windows
nosy: +barry, pitrou
priority: critical -> normal

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

> I also like Antoine's idea of pickling the function/method name instead of 
> the whole code object.

I like it too.  That's why I suggested it in the first comment on the ticket 
(read the linked code).  I guess Alexander likes it too, since he basically 
said as much in the second comment. ;)

--

___
Python tracker 

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



[issue8743] set() operators don't work with collections.Set instances

2010-08-02 Thread Ray.Allen

Ray.Allen  added the comment:

In my opinion, the set's operator should be a bit more liberal and accept any 
collections.Set instances. Given collections.Set is an ABC and isinstance(set, 
collections.Set) is True, the set methods should(strong recommended) follow all 
the generalized abstract semantic definition in the ABC. This according to PEP 
3119:
"""
In addition, the ABCs define a minimal set of methods that establish the 
characteristic behavior of the type. Code that discriminates objects based on 
their ABC type can trust that those methods will always be present. Each of 
these methods are accompanied by an generalized abstract semantic definition 
that is described in the documentation for the ABC. These standard semantic 
definitions are not enforced, but are strongly recommended.
"""

The collections.Set defines __or__() as this (for example):
"""
def __or__(self, other):
if not isinstance(other, Iterable):
return NotImplemented
chain = (e for s in (self, other) for e in s)
return self._from_iterable(chain)
"""
which means the "|" operator should accept all iterable. So I think it's better 
to make set's methods should be more liberal.

--
nosy: +ysj.ray

___
Python tracker 

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



[issue9373] pulldom has low code coverage

2010-08-02 Thread Mark Smith

Mark Smith  added the comment:

Added a patch to increase code coverage for the pulldom module to 90%.

This patch also includes 3 'expectedFailure' tests that I believe indicate 
erroneous behaviour, associated with issues #9453 (SAX2DOM doesn't like 
processing instructions before the root element), and #9371 (pulldom doesn't 
provide END_DOCUMENT or COMMENT nodes)

--
keywords: +patch
Added file: http://bugs.python.org/file18324/pulldom_tests.patch

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

There's already issue558238 on the same topic.

--

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Mon, Aug 2, 2010 at 10:32 AM, Jean-Paul Calderone
 wrote:
>
> Jean-Paul Calderone  added the comment:
>
>> I also like Antoine's idea of pickling the function/method name instead of 
>> the whole code object.
>
> I like it too.  That's why I suggested it in the first comment on the ticket 
> (read the linked
> code).  I guess Alexander likes it too, since he basically said as much in 
> the second
> comment. ;)

Yes, I think we have a consensus on this point. Note, however that
since unbound methods have been removed in 3.x, it is not trivial to
find a fully qualified name of a method anymore.   Also we need to
decide where to stop: should methods of nested classes be pickleable?

--

___
Python tracker 

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



[issue558238] Pickling bound methods

2010-08-02 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +merwok

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +merwok

___
Python tracker 

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



[issue8634] get method for dbm interface

2010-08-02 Thread Ray.Allen

Ray.Allen  added the comment:

+1 on generalize the dbm.gnu and gbm.ndbm, and also dbm.dumb. All of them 
should follow the Collections.MutableMapping ABC. I will work out a patch to 
fix this.

--
nosy: +ysj.ray

___
Python tracker 

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



[issue8634] get method for dbm interface

2010-08-02 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +merwok

___
Python tracker 

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



[issue9299] os.makedirs(): Add a keyword argument to suppress "File exists" exception

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Doc review: Small typo, Flase vs False.  Also, exceptions are "raised" rather 
than "thrown" in Python land (same for the docstring).  Both exception 
references should be :exc:`OSError`.

Otherwise, looks fine to me.

Raising priority; this should go into 3.2.

--
nosy: +georg.brandl
priority: normal -> critical

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Yes, I think we have a consensus on this point. Note, however that
> since unbound methods have been removed in 3.x, it is not trivial to
> find a fully qualified name of a method anymore.

I suppose only bound methods should be pickleable:

>>> class C:
... def m(self): pass
... 
>>> c = C()
>>> c.m
>
>>> c.m.__self__.__module__
'__main__'

And perhaps class methods too:

>>> class C:
... @classmethod
... def cm(self): pass
... 
>>> C.cm
>
>>> C.cm.__self__

>>> C.cm.__self__.__module__
'__main__'


> Also we need to
> decide where to stop: should methods of nested classes be pickleable?

As we want, but they needn't be.

--

___
Python tracker 

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



[issue558238] Pickling bound methods

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Let's continue the discussion on issue9276.

--
nosy:  -merwok
resolution:  -> duplicate
status: open -> closed
superseder:  -> pickle should support methods

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +hinsen, loewis, obamausa8, rhettinger

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Jean-Paul Calderone

Jean-Paul Calderone  added the comment:

> Note, however that since unbound methods have been removed in 3.x, it is not 
> trivial to find a fully qualified name of a method anymore.

This is a rather sad loss of functionality.

--

___
Python tracker 

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



[issue9264] trace.py documentation is incomplete

2010-08-02 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

You have about 5 hours as of this writing to apply the doc patch for Python 
2.6.6 rc1 and then it will be too late to get it into Python 2.6.6 (though I 
might make an exception for doc-only patches like this, for post rc1).

While I haven't built the docs, I don't have any objections to the patches.  If 
the docs build and look right, JFDI!

--

___
Python tracker 

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



[issue9264] trace.py documentation is incomplete

2010-08-02 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
priority: release blocker -> high

___
Python tracker 

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



[issue2986] difflib.SequenceMatcher not matching long sequences

2010-08-02 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

Georg committed this patch to the 2.6 tree, and besides, this is doesn't seem 
like a blocking issue, so I'm kicking 2.6 off the list and knocking the 
priority down.

--
priority: release blocker -> high
versions:  -Python 2.6

___
Python tracker 

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



[issue1748064] inspect.getargspec fails on built-in or slot wrapper methods

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

It *is* a feature request.  The signature of functions implemented in C is 
currently not exposed to introspection.

--
nosy: +georg.brandl
type: behavior -> feature request

___
Python tracker 

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



[issue9264] trace.py documentation is incomplete

2010-08-02 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

I'll try to meet the deadline. :-)

--

___
Python tracker 

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



[issue9264] trace.py documentation is incomplete

2010-08-02 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Oh, this is not assigned to me.  Terry, do you need help with this?

--

___
Python tracker 

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



[issue1195571] simple callback system for Py_FatalError

2010-08-02 Thread James William Pye

James William Pye  added the comment:

Would it be possible to require the embedding application to define the 
Py_FatalError symbol?

Admittedly, it would be nice to not have the callback installation code. =\

--

___
Python tracker 

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



[issue1195571] simple callback system for Py_FatalError

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This sounds like a good idea but why the strange semantics of needing it to be 
defined before calling PyInitialize()?

--
nosy: +pitrou

___
Python tracker 

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



[issue9276] pickle should support methods

2010-08-02 Thread Alexandre Vassalotti

Alexandre Vassalotti  added the comment:

The security issue mentioned previously has been known for years. And, it is 
easy to protect against. See 
http://docs.python.org/py3k/library/pickle.html#restricting-globals

Also I am against adding pickling support to code objects. Code objects have no 
backward-compatibility constraint unlike pickles.

Antoine is right about we should be using a method fully-qualified name to 
pickle it. However, the problem with this approach is a method doesn't always 
have fully-qualified name (see issue3657). ForkingPickler in 
Lib/multiprocessing/forking.py uses this approach to add pickling support to 
methods.

--

___
Python tracker 

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



[issue5752] xml.dom.minidom does not escape CR, LF and TAB characters within attribute values

2010-08-02 Thread W. Trevor King

W. Trevor King  added the comment:

As a workaround until the patch gets included, you can import this monkey patch 
module.

--
nosy: +labrat
Added file: http://bugs.python.org/file18325/minidom.py

___
Python tracker 

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



[issue1195571] simple callback system for Py_FatalError

2010-08-02 Thread James William Pye

James William Pye  added the comment:

I guess it seemed so unlikely that (C) extensions should be installing the 
callback that installation should be restricted pre-Py_Initialize(); the area 
completely controlled by the embedding app.

However, I have no strong attachment to that.

--

___
Python tracker 

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



[issue8042] mmap buffer implementation does not respect seek pos

2010-08-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

If you want to slice into a writable buffer, you can use a memoryview:

>>> b = io.BytesIO(b"abc")
>>> m = mmap.mmap(-1, 10)
>>> b.readinto(memoryview(m)[5:])
3
>>> m[:]
b'\x00\x00\x00\x00\x00abc\x00\x00'

This only works on 3.x, though.
As for changing the mmap buffer implementation, it would break compatibility 
and is therefore not acceptable, sorry.

--
nosy: +georg.brandl
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue5510] patches for Modules/socketmodule.c for NetBSD

2010-08-02 Thread Piotr Meyer

Piotr Meyer  added the comment:

On Sun, Aug 01, 2010 at 12:27:50AM +, Éric Araujo wrote:
> 
> Éric Araujo  added the comment:
> 
> Does the bug still exist in 3.2 (branch named py3k in subversion)? Do
> the patch still apply? (The workflow is to patch the version in
> development and then backport fixes to stable branches.)

As far I see - yes, py3k still needs patch provided by wiz, even on 
NetBSD 5.1 (current RC stable). Oryginal diff doesn't apply, I made 
some amateur changes and "my" version of wiz's patch is in attachment. 

But we have another problem, use sem_timedwait in Python/thread_pthread.h 
- not directly connected with this case, but prevent py3k from build.  
I copy some lines from Modules/_multiprocessing/semaphore.c, but this is 
very ugly workaround and someone should look at this...

--
Added file: http://bugs.python.org/file18326/netbsd-wizs-mod.patch

___
Python tracker 

___--- Modules/socketmodule.c.orig 2010-08-02 18:48:32.0 +0200
+++ Modules/socketmodule.c  2010-08-02 18:59:51.0 +0200
@@ -382,7 +382,7 @@
 #define SOCKETCLOSE close
 #endif
 
-#if defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H) &&  
!defined(__NetBSD__)
+#if defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H) &&  
!defined(__NetBSD__) && !defined(__DragonFly__)
 #define USE_BLUETOOTH 1
 #if defined(__FreeBSD__)
 #define BTPROTO_L2CAP BLUETOOTH_PROTO_L2CAP
@@ -396,11 +396,13 @@
 #define _BT_L2_MEMB(sa, memb) ((sa)->l2cap_##memb)
 #define _BT_RC_MEMB(sa, memb) ((sa)->rfcomm_##memb)
 #define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb)
-#elif defined(__NetBSD__)
+#elif defined(__NetBSD__) || defined(__DragonFly__)
 #define sockaddr_l2 sockaddr_bt
 #define sockaddr_rc sockaddr_bt
 #define sockaddr_hci sockaddr_bt
 #define sockaddr_sco sockaddr_bt
+#define SOL_HCI BTPROTO_HCI
+#define HCI_DATA_DIR SO_HCI_DIRECTION
 #define _BT_L2_MEMB(sa, memb) ((sa)->bt_##memb)
 #define _BT_RC_MEMB(sa, memb) ((sa)->bt_##memb)
 #define _BT_HCI_MEMB(sa, memb) ((sa)->bt_##memb)
@@ -1040,9 +1042,13 @@
 case BTPROTO_HCI:
 {
 struct sockaddr_hci *a = (struct sockaddr_hci *) addr;
+#if defined(__NetBSD__) || defined(__DragonFly__)
+return makebdaddr(&_BT_HCI_MEMB(a, bdaddr));
+#else
 PyObject *ret = NULL;
 ret = Py_BuildValue("i", _BT_HCI_MEMB(a, dev));
 return ret;
+#endif
 }
 
 #if !defined(__FreeBSD__)
@@ -1326,12 +1332,25 @@
 case BTPROTO_HCI:
 {
 struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret;
+#if defined(__NetBSD__) || defined(__DragonFly__)
+   char *straddr = PyBytes_AS_STRING(args);
+
+   _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
+if (straddr == NULL) {
+PyErr_SetString(socket_error, "getsockaddrarg: "
+"wrong format");
+return 0;
+}
+if (setbdaddr(straddr, &_BT_HCI_MEMB(addr, bdaddr)) < 0)
+return 0;
+#else
 _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH;
 if (!PyArg_ParseTuple(args, "i", &_BT_HCI_MEMB(addr, dev))) {
 PyErr_SetString(socket_error, "getsockaddrarg: "
 "wrong format");
 return 0;
 }
+#endif
 *len_ret = sizeof *addr;
 return 1;
 }
@@ -4417,9 +4436,13 @@
 PyModule_AddIntConstant(m, "BTPROTO_L2CAP", BTPROTO_L2CAP);
 PyModule_AddIntConstant(m, "BTPROTO_HCI", BTPROTO_HCI);
 PyModule_AddIntConstant(m, "SOL_HCI", SOL_HCI);
+#if !defined(__NetBSD__) && !defined(__DragonFly__)
 PyModule_AddIntConstant(m, "HCI_FILTER", HCI_FILTER);
+#endif
 #if !defined(__FreeBSD__)
+#if !defined(__NetBSD__) && !defined(__DragonFly__)
 PyModule_AddIntConstant(m, "HCI_TIME_STAMP", HCI_TIME_STAMP);
+#endif
 PyModule_AddIntConstant(m, "HCI_DATA_DIR", HCI_DATA_DIR);
 PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO);
 #endif
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8572] httplib getheader() throws error instead of default

2010-08-02 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

David, your suggested description was much better.
Modified the documentation in r83529 and r83530.

--
status: open -> closed

___
Python tracker 

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



[issue7372] Regression in pstats

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Fixed with your patch in r83531.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue9348] Calling argparse's add_argument with the wrong number of metavars causes delayed error message

2010-08-02 Thread Catherine Devlin

Catherine Devlin  added the comment:

I'm attaching a unit test patch that does something vaguely like Steven 
suggests.  It definitely needs review.

Also, I'm assuming that it's OK to specify *fewer* metavars than nargs, just 
not more... but I'm not sure about that.

--
keywords: +patch
nosy: +catherine
Added file: http://bugs.python.org/file18327/wrong_metavars_test.patch

___
Python tracker 

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



[issue8578] PyWeakref_GetObject

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

I added a note to the docs in r83536.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue6928] Doc: Class statements and metaclass = xxx

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Should be fixed in r83538.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue7849] Improve "test_support.check_warnings()"

2010-08-02 Thread Ezio Melotti

Ezio Melotti  added the comment:

I backported this to 2.6 in r83537 in order to fix #7092. I used a leading 
underscore on _check_py3k_warnings to make it private because no new features 
should be added to 2.6.

--

___
Python tracker 

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



[issue2716] Reimplement audioop because of copyright issues

2010-08-02 Thread Georg Brandl

Georg Brandl  added the comment:

Current status: no lawsuit yet.

--

___
Python tracker 

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



[issue1195571] simple callback system for Py_FatalError

2010-08-02 Thread James William Pye

Changes by James William Pye :


--
nosy:  -jwpye

___
Python tracker 

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



  1   2   >