[issue16997] subtests

2013-02-11 Thread holger krekel

holger krekel added the comment:

On Sun, Feb 10, 2013 at 12:41 PM, Antoine Pitrou rep...@bugs.python.orgwrote:


 Antoine Pitrou added the comment:

  Please don't commit I think we still need a discussion as to whether
  subtests or paramaterized tests are a better approach. I certainly
  don't think we need both and there are a lot of people asking for
  parameterized tests.

 I think they don't cater to the same crowd. I see parameterized tests as
 primarily used by people who like adding formal complexity to their
 tests in the name of architectural elegance (decorators, non-intuitive
 constructs and other additional boilerplate). Subtests are meant to not
 get in the way. IMHO, this makes them more suitable for stdlib
 inclusion, while the testing-in-python people can still rely on their
 additional frameworks.


Parametrized testing wasn't introduced because I or others like formal
complexity.  I invented the yield syntax that both pytest and nose still
support and it was enhanced for several years until it was deemed not fit
for a general purpose testing approach.  More specifically, if you have
functional parametrized tests, they each run relatively slow.   People
often want to re-run a single failing test or otherwise select tests which
use a certain fixture, or send tests to different CPUs to speed up
execution.   That's all not possible with subtests or am i missing
something?

That being said, I have plans to support some form of subtests for pytest
as well, as there are indeed cases where a more lightweight approach fits
well, especially for unit- or integration tests where one doesn't care if a
group of tests need to be re-run when working on fixing a failure to a
single subtest.  And where it's usually more about reporting, getting nice
debuggable output on failures.  I suspect the cases which Antoine refers
satisfy this pattern.

best,
holger

--

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



[issue16997] subtests

2013-02-11 Thread holger krekel

holger krekel added the comment:

On Sun, Feb 10, 2013 at 12:43 PM, Nick Coghlan rep...@bugs.python.orgwrote:


 Nick Coghlan added the comment:

 You can use subtests to build parameterized tests, you can't use
 parameterized tests to build subtests.

I doubt you can implement parametrized tests via subtests especially for
functional testing and its fixture needs.

The standard library can also
 be converted to using subtests *far* more readily than it could be
 converted to parameterized tests.

I can see that and for this reason and the stdlib's use cases it might make
sense to support it.  The unittest module is also used in many other
contexts so it shouldn't be the only verification criterium.

best,
holger

--

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Mark Dickinson

Mark Dickinson added the comment:

Hmm;  good point.  Well, +1 to the functionality, anyway;  I'll leave the 
discussion about the name.

--

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



[issue17179] TypeError: type() takes 1 or 3 arguments

2013-02-11 Thread Chris Withers

New submission from Chris Withers:

 from types import new_class
 from datetime import datetime
 new_class('tdatetime', (datetime, ), kwds={'foo':'bar'})
Traceback (most recent call last):
  File console, line 1, in module
  File /src/Python-3.3.0/Lib/types.py, line 52, in new_class
return meta(name, bases, ns, **kwds)
TypeError: type() takes 1 or 3 arguments

I'm guessing ns and kwds should be combined before being passed through to 
meta? (meta is 'type' in this case)

--
components: Library (Lib)
messages: 181884
nosy: cjw296
priority: normal
severity: normal
status: open
title: TypeError: type() takes 1 or 3 arguments
versions: Python 3.3

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



[issue17180] shutil copy* unsafe on POSIX - they preserve setuid/setgit bits

2013-02-11 Thread Milko Krachounov

New submission from Milko Krachounov:

When copying the mode of a file with copy, copy2, copymode, copystat or 
copytree, all permission bits are copied (including setuid and setgit), but the 
owner of the file is not. This can be used for privilege escalation.

An example:

-rwSr--r--  1 milko milko0 фев 11 10:53 test1

shutil.copy(test1, test2)

-rwSr--r--  1 root  root 0 фев 11 10:53 test2

If test1 contained anything malicious, now the user milko can execute his 
malicious payload as root.

Potential fixes:
- Strip setuid/setgid bits.
- Copy the owner on POSIX.
- Perform a safety check on the owner.
- Document the security risk.


The behaviour of copymode/copystat in this case is the same as `chmod 
--reference', and there can be some expectation of unsafety, but 
copy/copy2/copytree's behaviour differs from that of `cp -p', and this is a 
non-obvious difference.

--
components: Library (Lib)
messages: 181885
nosy: milko.krachounov
priority: normal
severity: normal
status: open
title: shutil copy* unsafe on POSIX - they preserve setuid/setgit bits
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is a problem with test_pwd on 64-bit platform. It expects KeyError on 
pwd.getpwuid(sys.maxsize). Actually the test is not looks robust. On 32-bit 
platform sys.maxsize = 2**31-1  2**32 and this value only by chance was not in 
the user database. On 64-bit platform sys.maxsize  2**32 and in old code it 
was wrapped to 2**31-1 C unsigned int value and this value only by chance was 
not in the user database. New code doesn't wrap the value to C unsigned int and 
raises an overflow exception.

What should I change, a test or a raised exception?

--

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



[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-11 Thread Nick Coghlan

Nick Coghlan added the comment:

On Mon, Feb 11, 2013 at 11:46 AM, Terry J. Reedy rep...@bugs.python.org wrote:
 I am also puzzled by the 'from None' part in
 + raise TypeError('{!r}' is not a Python function.format(func)) from None

 While I remember that being in the pydev discussion and while raise XyzError 
 from None executes, it does not seems to be documented for 3.3 in 7.8. The 
 raise statement. (Should this be another issue?) In fact, that section says  
 if given, the second expression must be another exception class or instance, 
 which excludes None.

That's a separate docs bug - it seems we missed the necessary language
reference updates when implementing PEP 309. The relevant docs are
here: http://docs.python.org/3/library/exceptions.html#built-in-exceptions

--

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



[issue16997] subtests

2013-02-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 what if there are 500 subtests in a loop and you don't want 500 failures to be
 registered for that test case?

Parametered tests have the same issue. In this case you simply don't use 
subtests
or test cases. On the other hand, the issue doesn't exist in most cases where 
you
iterate over three or four different cases.

 addMessage was just one suggestion.

It is quite orthogonal, actually, and could be added independently. Also, it is 
not clear how you would limit the addMessage to a subtest, rather than the 
whole test case.
We could re-use testtools' addDetail idea, although their content-type thing
is a bit heavyweight: I'd rather duck-type the API.

http://testtools.readthedocs.org/en/latest/for-test-authors.html#details

--

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



[issue17181] SSLContext.set_servername_callback should be able to set argument

2013-02-11 Thread Daniel Black

New submission from Daniel Black:

I think my original implementation of the SNI callback to see a original 
sslcontext was wrong. It would be much more useful for the 
SSLContext.set_servername_callback to take a callable and an object as an 
argument.

This would allow constructs like the following where self can be used within 
the callback. Example:

def cb_sni(ssl_sock, server_name, self):
self.sniname = server_name

self.context.set_servername_callback(cb_sni, self)

The original functionality can still occur with:

self.context.set_servername_callback(cb_sni, self.context)

Agree?

--
components: Library (Lib)
messages: 181889
nosy: grooverdan, pitrou
priority: normal
severity: normal
status: open
title: SSLContext.set_servername_callback should be able to set argument
type: enhancement
versions: Python 3.5

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



[issue10852] SSL/TLS sni use in smtp, pop, imap, nntp, ftp client libs by default

2013-02-11 Thread Daniel Black

Daniel Black added the comment:

Ack. Have fix. Simple if self.certfile or self.keyfile: test added before 
load_cert_chain.

part way through developing test. Thinking #17181 would help.

--

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



[issue17052] unittest discovery should use self.testLoader

2013-02-11 Thread Michael Foord

Michael Foord added the comment:

I think you're right! Thanks.

--
assignee:  - michael.foord
resolution: fixed - 
status: closed - open

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



[issue17152] Array module should support boolean natively

2013-02-11 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

we have a -1, so I close this as rejected.

I still think it is a valuable idea to pursuit.

--
resolution:  - rejected
status: open - closed

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



[issue17152] Array module should support boolean natively

2013-02-11 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
stage:  - committed/rejected

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



[issue17044] Implement PEP 422: Simple class initialisation hook

2013-02-11 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

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



[issue17052] unittest discovery should use self.testLoader

2013-02-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ece0a2e6b08e by Michael Foord in branch '2.7':
Correction to issue 17052 fix
http://hg.python.org/cpython/rev/ece0a2e6b08e

New changeset 867763eb6985 by Michael Foord in branch '3.2':
Correction to issue 17052 fix
http://hg.python.org/cpython/rev/867763eb6985

New changeset a79650aacb43 by Michael Foord in branch 'default':
Merge. Closes issue 17052.
http://hg.python.org/cpython/rev/a79650aacb43

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

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



[issue17182] signal.default_int_handler should set signal number on the raised exception

2013-02-11 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Having a dedicated optional attribute on KeyboardInterrupt receiving the signal 
number would be useful in certain circumstances, for example if you want to 
propagate the signal to a child process.

--
components: Extension Modules
messages: 181894
nosy: pitrou
priority: normal
severity: normal
status: open
title: signal.default_int_handler should set signal number on the raised 
exception
type: enhancement
versions: Python 3.4

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



[issue17063] assert_called_with could be more powerful if it allowed placeholders

2013-02-11 Thread Michael Foord

Michael Foord added the comment:

I still don't particularly like the idea of the assert_* methods returning 
something.

If the call args tuples had args and kwargs attributes, for which there are 
outstanding feature requests, then you could simply do:

my_mock(1, someobj(), bar=someotherobj())

foo = my_mock.call_args.args[1]
bar = my_mock.call_args.kwargs['bar']

By avoiding the extra step of tuple unpacking this is still nice and readable 
(IMO).

--

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



[issue17064] Fix sporadic buildbot failures for test_mailbox

2013-02-11 Thread R. David Murray

R. David Murray added the comment:

Thanks, Jeremy.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type:  - behavior
versions: +Python 2.7, Python 3.2 -Python 3.5

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



[issue17181] SSLContext.set_servername_callback should be able to set argument

2013-02-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 This would allow constructs like the following where self can be used
 within the callback. Example:
 
 def cb_sni(ssl_sock, server_name, self):
 self.sniname = server_name
 
 self.context.set_servername_callback(cb_sni, self)
 
 The original functionality can still occur with:
 
 self.context.set_servername_callback(cb_sni, self.context)

But you could simply use a closure:

def cb_sni(ssl_sock, server_name):
self.sniname = server_name

self.context.set_servername_callback(cb_sni)

--
title: SSLContext.set_servername_callback should be able to set argument - 
SSLContext.set_servername_callback should be able to setargument

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Eric V. Smith

Eric V. Smith added the comment:

+1 for PyIndex_AsLong()

--
nosy: +eric.smith

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



[issue17064] Fix sporadic buildbot failures for test_mailbox

2013-02-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bbeff2958cc5 by R David Murray in branch '3.2':
#17064: fix sporadic permission errors in test_mailbox on windows.
http://hg.python.org/cpython/rev/bbeff2958cc5

New changeset 3e3915cbfde3 by R David Murray in branch '3.3':
Merge: #17064: fix sporadic permission errors in test_mailbox on windows.
http://hg.python.org/cpython/rev/3e3915cbfde3

New changeset aa15df77e58f by R David Murray in branch 'default':
Merge: #17064: fix sporadic permission errors in test_mailbox on windows.
http://hg.python.org/cpython/rev/aa15df77e58f

New changeset 1c2dbed859ca by R David Murray in branch '2.7':
#17064: fix sporadic permission errors in test_mailbox on windows.
http://hg.python.org/cpython/rev/1c2dbed859ca

--
nosy: +python-dev

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



[issue9874] Message.attach() loses empty attachments

2013-02-11 Thread R. David Murray

R. David Murray added the comment:

Lacking a reproducer, there's not much we can do here, so closing.

--
resolution:  - works for me
stage: test needed - committed/rejected
status: open - closed

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



[issue17171] email.encoders.encode7or8bit does not work with binary data

2013-02-11 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
type:  - behavior

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



[issue15767] add ModuleNotFoundError

2013-02-11 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

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



[issue15767] add ModuleNotFoundError

2013-02-11 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

For me, it mostly comes down to whether end-users are expected to see such 
errors generally or not.  We see ImportErrors all the time, and they are 
clearly errors.  If we're expected to see and deal with MNF, and if in such 
cases it's generally considered an error, then MNFError is better.  If it's 
mostly an internal/hidden thing, then MNF doesn't bother me.

--

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



[issue16935] unittest should understand SkipTest at import time during test discovery

2013-02-11 Thread Zachary Ware

Zachary Ware added the comment:

Sure can.  With a little luck, I'll have the patch ready later today; with less 
luck it'll be sometime later this week.

--

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



[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Guido Reina

New submission from Guido Reina:

In the file: Lib/_markupbase.py, function: _parse_doctype_element there is:

if '' in rawdata[j:]:
return rawdata.find(, j) + 1

rawdata[j:] is being scanned twice.

It would be better to do:
pos = rawdata.find(, j)
if pos != -1:
return pos + 1


Same thing in the function: _parse_doctype_attlist:

if ) in rawdata[j:]:
j = rawdata.find(), j) + 1
else:
return -1

It would be better to do:
pos = rawdata.find(), j)
if pos != -1:
j = pos + 1
else:
return -1

--
messages: 181903
nosy: guido
priority: normal
severity: normal
status: open
title: Small enhancements to Lib/_markupbase.py
type: enhancement
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5

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



[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Ezio Melotti

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


--
assignee:  - ezio.melotti
components: +Library (Lib)
nosy: +ezio.melotti
stage:  - needs patch
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.5

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



[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 if '' in rawdata[j:]:
 return rawdata.find(, j) + 1

See issue17170 for this idiom.

--
nosy: +serhiy.storchaka

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



[issue17171] email.encoders.encode7or8bit does not work with binary data

2013-02-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f83581135ec4 by R David Murray in branch '3.2':
#17171: fix email.encoders.encode_7or8bit when applied to binary data.
http://hg.python.org/cpython/rev/f83581135ec4

New changeset cabcddbed377 by R David Murray in branch '3.3':
Merge: #17171: fix email.encoders.encode_7or8bit when applied to binary data.
http://hg.python.org/cpython/rev/cabcddbed377

New changeset a80b67611c6d by R David Murray in branch 'default':
Merge: #17171: fix email.encoders.encode_7or8bit when applied to binary data.
http://hg.python.org/cpython/rev/a80b67611c6d

New changeset e44fa71d76fe by R David Murray in branch '2.7':
#17171: backport behavior-confirming test from python3.
http://hg.python.org/cpython/rev/e44fa71d76fe

--
nosy: +python-dev

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



[issue17171] email.encoders.encode7or8bit does not work with binary data

2013-02-11 Thread R. David Murray

R. David Murray added the comment:

Since this was straightforwardly similar to the issue 16564 fix I didn't bother 
with a review.  The 2.7 commit is backporting the behavior-confirming test, 
just for thoroughness.

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

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 (perhaps we need as PyNumber_AsLongIndex() to do the direct conversion
to a C long, it would make things easier in many cases)

In this case we need PyNumber_AsLongAndOverflowIndex() and 
PyNumber_AsUnsignedLongIndex(). And a lot of other parallel functions for other 
cases. This can exponentially increase a number of functions.

--

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Not technically the topic of this issue, but should we just lock
 down _Py_Uid_Converter() to ints?

I just copied this code from PyArg_ParseTuple*() for 'l' format.

 This is still accepted:

 os.setuid(Decimal(1000.2))

Any C implemented function which parses an integer argument with 
PyArg_ParseTuple*() accepts decimals.

 chr(65.2)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: integer argument expected, got float
 chr(Decimal('65.2'))
'A'

I think this is an offtopic for this issue.

--

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



[issue16935] unittest should understand SkipTest at import time during test discovery

2013-02-11 Thread Zachary Ware

Zachary Ware added the comment:

I think this patch should cover the test and Doc changes necessary.  Of course, 
let me know if it doesn't :)

--
Added file: http://bugs.python.org/file29039/issue16935.v2.diff

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Stefan Krah

Stefan Krah added the comment:

Serhiy Storchaka rep...@bugs.python.org wrote:
  Not technically the topic of this issue, but should we just lock
  down _Py_Uid_Converter() to ints?
 
 I just copied this code from PyArg_ParseTuple*() for 'l' format.

  os.setuid(Decimal(1000.2))

I know that this behavior wasn't introduced by you. It's perfectly fine
to use PyArg_ParseTuple() for guidance or to try to preserve the existing
behavior.

  chr(Decimal('65.2'))
 'A'

I just happen to think that PyArg_ParseTuple() is wrong here and we shouldn't
enable this feature in new code. Fixing these issues one by one is probably
the best way forward.

--

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



[issue17130] Add runcall() function to profile.py and cProfile.py

2013-02-11 Thread Guido van Rossum

Guido van Rossum added the comment:

Antoine, what about the decorator? I've come across a few use cases.

--Guido van Rossum (sent from Android phone)
On Feb 10, 2013 10:14 AM, Antoine Pitrou rep...@bugs.python.org wrote:


 Antoine Pitrou added the comment:

 +1 for runcall() and the context manager.

 --
 nosy: +pitrou

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue17130
 ___


--

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



[issue17052] unittest discovery should use self.testLoader

2013-02-11 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks a lot for taking care of this issue, Michael.

--

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



[issue17130] Add runcall() function to profile.py and cProfile.py

2013-02-11 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

See issue 9285 in which I wrote a decorator for profile/cProfile.
That can be modified to work both as a decorator or a context manager by using 
contextlib.contextmanager.
Shall I continue in issue 9285 and rewrite that patch?

--
nosy: +giampaolo.rodola

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



[issue15767] add ModuleNotFoundError

2013-02-11 Thread Brett Cannon

Brett Cannon added the comment:

Right, so what's typical? =) I mean do most people see ImportError for optional 
modules (e.g. not on support platforms), or do most people see ImportError 
because they messed up and tried to import something that they expected but 
actually isn't there for some reason.

--

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



[issue12077] Harmonizing descriptor protocol documentation

2013-02-11 Thread Franck Michea

Franck Michea added the comment:

Here is at least a correction of Descriptors' HowTo. There are two versions 
since some stuff differs (object inheritance, ...).

Here are some of my interrogations though:
 - RevealAccess is not using instance parameter, so value is shared. Is this 
intended?
 - Don't really know what to do with Function and Methods part. First I don't 
really understand the relevance of this in a descriptor how-to. Also it is know 
outdated in python3 version (unbound thing, ...), so what do?
 - In __getattribute__ function, I don't really understand the paramters given 
to __get__, why None and the instance? But this is probably my fault.

This also doesn't answer the question about the real source that should be 
kept. What to do?

I also need a proof-read, since english is not my first language... Anyway it's 
clearly not enough to be published like that

Have a nice day!

--
keywords: +patch
nosy: +kushou
versions: +Python 3.5
Added file: 
http://bugs.python.org/file29040/12077_descriptor_howto_python3.patch

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



[issue12077] Harmonizing descriptor protocol documentation

2013-02-11 Thread Franck Michea

Changes by Franck Michea franck.mic...@gmail.com:


Added file: 
http://bugs.python.org/file29041/12077_descriptor_howto_python2.patch

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



[issue17130] Add runcall() function to profile.py and cProfile.py

2013-02-11 Thread Guido van Rossum

Guido van Rossum added the comment:

Sure, I will comment on that issue.

--

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



[issue9285] Add a profile decorator to profile and cProfile

2013-02-11 Thread Guido van Rossum

Guido van Rossum added the comment:

Brief comments:

- Please don't call it profile -- we already have a module by that name.

- Please make it so that both the decorator and context manager can specify a 
file where to dump the raw data -- basically it needs to have the same 
functionality as the functions run()/runctx()/runcall() (the latter TBD, see 
issue 17130).

- Please also make Profile object itself the context manager -- all you have to 
do is add __enter__() and __exit__() that call enable() and disable().  (But 
this doesn't completely replace the global function, which has more 
functionality -- it prints the profile or dumps the data).

--
nosy: +gvanrossum

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



[issue9285] Add a profile decorator to profile and cProfile

2013-02-11 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Ok, will look into this soon.

--

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



[issue15767] add ModuleNotFoundError

2013-02-11 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Feb 11, 2013, at 05:31 PM, Brett Cannon wrote:

Right, so what's typical? =) I mean do most people see ImportError for
optional modules (e.g. not on support platforms), or do most people see
ImportError because they messed up and tried to import something that they
expected but actually isn't there for some reason.

There are a few common use cases (or perhaps anti-use cases) where you see
ImportErrors.  I might be missing some, but I'd put these in roughly
descending order of commonness.

* Trying alternative imports for compatibility reasons.  You always expect
  ImportErrors in these cases, and you'll always catch them in try/excepts.

* Missing modules, submodules, or attributes in from-imports.  These can be
  unexpected if you think you've got the right version of a package, or
  expected for compatibility reasons.

* Trying to conditionally import optional modules.  Again, expected, and
  they'll be wrapped in try/except.

I guess the case you're trying to differentiate with MNF is, the from-import
case, i.e. did the error occur because the module was missing or because the
attribute was missing?

It's hard to say which is more likely, which I guess is why you're having a
hard time deciding. :) If I had to vote, I'd go with MNFError 1) because it's
a subclass of ImportError; 2) it'll be more informative in the case where it
really *is* an error; 3) isn't that big of a deal in cases where it's
expected; 4) we're used to seeing ImportError anyway, and probably most code
won't care and will just use ImportError.

--

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 There is a problem with test_pwd on 64-bit platform.

Fixed in changesets a0983e46feb1 and 1e9fa629756c: Raise KeyError instead of 
OverflowError when getpwuid's argument is out of uid_t range.

--

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



[issue17130] Add runcall() function to profile.py and cProfile.py

2013-02-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Antoine, what about the decorator? I've come across a few use cases.

I don't know, I'm thinking that there should be one obvious way to do
it :-)
By that I mean that the context manager is more generic than the
decorator. Or do you want to decorate functions from an external
library?

--

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 In this case we need PyNumber_AsLongAndOverflowIndex() and
 PyNumber_AsUnsignedLongIndex(). And a lot of other parallel functions
 for other cases. This can exponentially increase a number of functions.

I don't think it will be exponential :-)

--

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



[issue17181] SSLContext.set_servername_callback should be able to set argument

2013-02-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

(functools.partial is another solution to the problem)

--

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



[issue17130] Add runcall() function to profile.py and cProfile.py

2013-02-11 Thread Guido van Rossum

Guido van Rossum added the comment:

If I quickly want to profile one function, with the decorator I have to
insert a with-statement in its body and mess with the indentation of the
entire body. With a decorator it's just a one-line insertion.

--

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



[issue17130] Add runcall() function to profile.py and cProfile.py

2013-02-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ah, fair enough.

--

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



[issue15767] add ModuleNotFoundError

2013-02-11 Thread Brett Cannon

Brett Cannon added the comment:

Screw it, I'll go with ModuleNotFoundError since it is a subclass of 
ImportError and so it might come off as weird as saying the superclass is an 
Error but the subclass is not.

--

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



[issue17184] re.VERBOSE doesn't respect whitespace in '( ?Pfoo...)'

2013-02-11 Thread Roy Smith

New submission from Roy Smith:

# Python 2.7.3
# Ubuntu 12.04

import re
pattern = r( ?Pphrase.*)
regex = re.compile(pattern, re.VERBOSE)

The above raises an exception in re.compile():

Traceback (most recent call last):
  File ./try.py, line 6, in module
regex = re.compile(pattern, re.VERBOSE)
  File /home/roy/env/python/lib/python2.7/re.py, line 190, in compile
return _compile(pattern, flags)
  File /home/roy/env/python/lib/python2.7/re.py, line 242, in _compile
raise error, v # invalid expression
sre_constants.error: nothing to repeat

The problem appears to be that re.VERBOSE isn't ignoring the space after the 
(.

Maybe this is a duplicate of issue15606 ?

--
components: Library (Lib)
messages: 181927
nosy: roysmith
priority: normal
severity: normal
status: open
title: re.VERBOSE doesn't respect whitespace in '( ?Pfoo...)'
type: behavior
versions: Python 2.7

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



[issue15606] re.VERBOSE whitespace behavior not completely documented

2013-02-11 Thread Roy Smith

Changes by Roy Smith r...@panix.com:


--
nosy: +roysmith

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



[issue17170] string method lookup is too slow

2013-02-11 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox, haypo

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



[issue17184] re.VERBOSE doesn't respect whitespace in '( ?Pfoo...)'

2013-02-11 Thread Ezio Melotti

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


--
components: +Regular Expressions
nosy: +ezio.melotti, mrabarnett

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



[issue15606] re.VERBOSE whitespace behavior not completely documented

2013-02-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also related issue11204.

--
nosy: +serhiy.storchaka

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



[issue17130] Add runcall() function to profile.py and cProfile.py

2013-02-11 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

As for runcall() we haven't the ability to freely support kwargs *and* filename.
I see two possibilities.
Kill kwargs, as such:

+def runcall(func, *args, filename=None, sort=-1):
+Run func(*args) under profiler, optionally saving results in
+filename.
+

...or make 'filename_' and 'sort_' two special name kwargs to be used as in:

 runcall(fun, foo=1, bar=2, filename_='...')

Also, there might be some value in adding 'strip_dirs' argument to those 
functions (run/runctx/runcall).

--

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



[issue11204] re module: strange behaviour of space inside {m, n}

2013-02-11 Thread Roy Smith

Changes by Roy Smith r...@panix.com:


--
nosy: +roysmith

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



[issue16997] subtests

2013-02-11 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 what if there are 500 subtests in a loop and you don't want 500 failures to 
 be
 registered for that test case?

 Parametered tests have the same issue. In this case you simply don't use 
 subtests
 or test cases.

Right, but then you lose out on both of the benefits documented for subtests:

+Without using a subtest, execution would stop after the first failure,
+and the error would be less easy to diagnose because the value of ``i``
+wouldn't be displayed::

Why tie these together?  I'm suggesting that we expose a way to benefit from 
the easy to diagnose portion without the suspend stoppage portion.  (The 
way we do this doesn't have to be one of the ways I'm suggesting, though I've 
suggested a few.)

 addMessage was just one suggestion.

 It is quite orthogonal, actually, and could be added independently. Also, it 
 is not clear how you would limit the addMessage to a subtest, rather than the 
 whole test case.

It's not orthogonal because the way I suggested it, subTest() would be the 
composition of addMessage() and continueTest() context managers.  (addMessage 
limits itself by being a context manager just like subTest.)  So if we added 
addMessage() later, we would want to refactor subTest() to be using it.  The 
equivalence would be something like the following:

with self.subTest(msg=msg, i=i):
self.assertEqual(i % 2, 0)

with self.continueTest():
with self.addMessage(msg, i=i):
self.assertEqual(i % 2, 0)

However, since it looks like we're going with changing the test case ID instead 
of putting the extra data only in the exception message (TestCase.longMessage) 
like I was suggesting before, I think adding a failFast=True or maxFailures=n 
parameter to subTest() has higher importance, e.g.

with self.subTest(msg=msg, maxFailures=1, i=i):
self.assertEqual(i % 2, 0)

--

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



[issue17184] re.VERBOSE doesn't respect whitespace in '( ?Pfoo...)'

2013-02-11 Thread Matthew Barnett

Matthew Barnett added the comment:

It does look like a duplicate to me.

--

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



[issue16997] subtests

2013-02-11 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy:  -brett.cannon

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



[issue16997] subtests

2013-02-11 Thread Yaroslav Halchenko

Changes by Yaroslav Halchenko yarikop...@gmail.com:


--
nosy:  -Yaroslav.Halchenko

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



[issue15351] Add to unittest.TestCase support for using context managers

2013-02-11 Thread Michael Foord

Changes by Michael Foord mich...@voidspace.org.uk:


--
assignee:  - michael.foord

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



[issue13555] cPickle MemoryError when loading large file (while pickle works)

2013-02-11 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file29020/pickle_overflow-3.diff

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



[issue13555] cPickle MemoryError when loading large file (while pickle works)

2013-02-11 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Test updated too. Now it doesn't try to write a string larger than 2 GiB (it's 
impossible), instead writes a lot of shorter strings with total size larger 
than 2 GiB.

--
Added file: http://bugs.python.org/file29042/pickle_overflow-4.diff

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



[issue17170] string method lookup is too slow

2013-02-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A related issue: the speed of finding and hence replacing chars in strings is 
known to have regressed in 3.3 relative to 3.2, especially on Windows. For long 
strings, that will negate in 3.3 the speedup for the initial method call. See 
#16061, with patches. The holdup seems to be deciding which of two good patches 
to apply.

--
nosy: +terry.reedy

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



[issue17185] create_autospec

2013-02-11 Thread Chris Withers

New submission from Chris Withers:

Sticking an issue in at Michael's request...

Older versions of mock had a helper called mocksignature.
In newer versions, create_autospec replaces this, but doesn't get it right 
sometimes:

 from inspect import getargspec
 from mock import create_autospec
 def myfunc(x, y): pass
...
 getargspec(myfunc)
ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)
 getargspec(create_autospec(myfunc))
ArgSpec(args=[], varargs='args', keywords='kwargs', defaults=None)

mocksignature gets it right:

 from mock import mocksignature
 getargspec(mocksignature(myfunc))
ArgSpec(args=['x', 'y'], varargs=None, keywords=None, defaults=None)

--
assignee: michael.foord
messages: 181934
nosy: cjw296, michael.foord
priority: normal
severity: normal
status: open
title: create_autospec

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



[issue17186] no way to introspect registered atexit handlers

2013-02-11 Thread Chris Withers

New submission from Chris Withers:

Python 2 had a private but usable way of introspecting and manipulating 
registered atexit handlers by way of the atexit._exithandlers.

In Python 3, registering and unregistering are handled, but there is no longer 
a way to see what atexit handlers are registered.

Barry suggested filing a bug to have this added as a new feature for Python 
3.4. Some kind of read-only sequence would be fine, if the original list can no 
longer be exposed.

--
messages: 181935
nosy: cjw296
priority: normal
severity: normal
status: open
title: no way to introspect registered atexit handlers
versions: Python 3.4

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



[issue17187] Python segfaults from improperly formed and called function

2013-02-11 Thread Larry Hastings

New submission from Larry Hastings:

Python 3.3 added a nice new feature: if you don't supply enough positional 
parameters to a function, it tells you the names of the positional parameters 
you omitted.

Unfortunately, the code that prints this error message assumes that the 
function is well-formed.  If I manually create a function using types.CodeType 
and types.FunctionType, and I don't provide enough entries in the 
types.CodeType  varnames parameter to satisfy all the positional parameters, 
and I call the resulting function with insufficient parameters, Python crashes.

I've attached a sample script that demonstrates this crash.  I can reproduce it 
with both 3.3.0 and a recent trunk.  Since this feature wasn't in 3.2 or 
before, the bug doesn't seem to exist in those versions; I couldn't reproduce 
with 3.2 or 2.7.

The crash occurs in missing_arguments() in Python/ceval.c, line 3256 in trunk.  
The function calls PyTuple_GET_ITEM on the co_varnames tuple without checking 
that it has sufficient entries.  It gets a crazytown pointer, calls 
PyObject_Repr on it, and boom.

I've attached a band-aid patch which prevents the crash, but this is almost 
certainly not the fix we want.  Perhaps types.CodeType should refuse to 
generate the malformed code object in the first place?

--
components: Interpreter Core
files: crashy.py
keywords: 3.3regression
messages: 181936
nosy: larry
priority: normal
severity: normal
stage: needs patch
status: open
title: Python segfaults from improperly formed and called function
type: crash
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29043/crashy.py

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



[issue17187] Python segfaults from improperly formed and called function

2013-02-11 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
keywords: +patch
Added file: 
http://bugs.python.org/file29044/lch.bandaid.for.malformed.fn.crash.1.patch

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



[issue16851] Hint about correct ismethod and isfunction usage

2013-02-11 Thread Greg Couch

Greg Couch added the comment:

In my opinion, the Python 2.7 results are wrong.

In Python 2.7, inspect.ismethod returns True for both bound and unbound methods 
-- ie., is broken according to the documentation.  As a workaround, I'm using:

def is_bound_method(obj):
return hasattr(obj, '__self__') and obj.__self__ is not None

is_bound_method also works for methods of classes implemented in C, e.g., int:

 a = 1
 is_bound_method(a.__add__)
True
 is_bound_method(int.__add__)
False

But is not very useful in that case because inspect.getargspec does not work 
for functions implemented in C.

is_bound_method works unchanged in Python 3, but as noted above, in Python 3, 
inspect.ismethod properly distinguishes between bound and unbound methods, so 
it is not necessary.

--
nosy: +gregcouch

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



[issue16997] subtests

2013-02-11 Thread Andrew Bennetts

Andrew Bennetts added the comment:

googletest (an xUnit style C++ test framework) has an interesting feature: in 
addition to assertions like ASSERT_EQ(x, y) that stop the test, it has 
EXPECT_EQ(x, y) etc that will cause the test to fail without causing it to 
stop.  I think this decoupling of “test failed” and “test execution stopped” is 
very useful.  (Note this also implies a single test can have multiple failures, 
or if you prefer that a single test can have multiple messages attached to 
explain why its state is 'FAILED'.)

I wouldn't like to see a duplication of all assert* methods as expect* methods, 
but there are alternatives.  A single self.expectThat method that takes a value 
and a matcher, for instance.

Or you could have a context manager:

with self.continueOnFailure():
self.assertEqual(x, y)

In fact, I suppose that's more-or-less what the subtests patch offers?  Except 
the subtests feature seems to want to get involved in knowing about parameters 
and the like too, which feels weird to me.

Basically, I really don't like the “subtests” name, but if instead it's named 
something that directly says its only effect is that failures don't abort the 
test, then I'd be happy.

--

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



[issue17188] Document 'from None' in raise statement doc.

2013-02-11 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Language manual, section 7.8. The raise statement has no mention of the 'from 
None' option. Indeed it says if given, the second expression must be another 
exception class or instance, which would exclude None.

Library manual, Ch 5. Built-in Exceptions, says
'''
When raising a new exception (rather than using a bare raise to re-raise the 
exception currently being handled), the implicit exception context can be 
supplemented with an explicit cause by using from with raise:

raise new_exc from original_exc

The expression following from must be an exception or None. It will be set as 
__cause__ on the raised exception. Setting __cause__ also implicitly sets the 
__suppress_context__ attribute to True, so that using raise new_exc from None 
effectively replaces the old exception with the new one for display purposes 
(e.g. converting KeyError to AttributeError, while leaving the old exception 
available in __context__ for introspection when debugging.
'''
I am not sure how much should be copied over, but None should be at least 
mentioned and perhaps there should be a cross-reference.

I am also not sure how much applies to 3.2, but there is no version-added or 
-changed note with the above.

--
assignee: docs@python
components: Documentation
messages: 181939
nosy: docs@python, ncoghlan, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Document 'from None' in raise statement doc.
versions: Python 3.2, Python 3.3, Python 3.4

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



[issue17159] Remove explicit type check from inspect.Signature.from_function()

2013-02-11 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I opened separate issue #17188:
Document 'from None' in raise statement doc.

--

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



[issue17189] Add zip64 support to shutil

2013-02-11 Thread William Mallard

New submission from William Mallard:

This patch enables creation of 64-bit zip files via make_archive().

make_archive uses ZipFile to create zip files. ZipFile already supports 
creation of 64-bit archives via a kwarg, but make_archive hard-codes it to 
32-bit. This patch exposes the option in a backwards compatible way.

--
components: Library (Lib)
files: shutil_zip64.patch
keywords: patch
messages: 181941
nosy: william.mallard
priority: normal
severity: normal
status: open
title: Add zip64 support to shutil
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file29045/shutil_zip64.patch

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



[issue1518] Fast globals/builtins access (patch)

2013-02-11 Thread Larry Hastings

Larry Hastings added the comment:

It sort of looks like this was closed because we assumed we were moving to 
Unladen Swallow.  We're not.  Should this be reopened?

--
nosy: +larry

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



[issue17111] test_surrogates of test_fileio fails sometimes on OS X 10.4

2013-02-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9497adb7355f by Ned Deily in branch '2.7':
Issue #17111: Prevent test_surrogates (test_fileio) failure on OS X 10.4.
http://hg.python.org/cpython/rev/9497adb7355f

--
nosy: +python-dev

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



[issue17111] test_surrogates of test_fileio fails sometimes on OS X 10.4

2013-02-11 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


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

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



[issue17190] _FAST opcodes do no range checking

2013-02-11 Thread Larry Hastings

New submission from Larry Hastings:

The implementations for LOAD_FAST, STORE_FAST, and DELETE_FAST don't check that 
the index is = the size of fastlocals.  So it's a snap to crash the 
interpreter with hand-written bytecode, by going past the end of the fastlocals 
array.  Kaboom!

Attached is a program that demonstrates a crash with each of LOAD_FAST, 
STORE_FAST, and DELETE_FAST.  These all crashed 2.7, 3.2, 3.3, and a recent 
trunk.  (Well, two exceptions: LOAD_FAST and DELETE_FAST didn't crash 3.2.  
Given the behavior, my suspicion is not that 3.2 is hardened, just that there's 
something dopey with my thrown-together test.)

It could be that this is not an interesting bug, that policy suggests that 
anyone who can write their own bytecode is a Consenting Adult.  You tell me.

--
components: Interpreter Core
files: crashy2.py
messages: 181944
nosy: larry
priority: normal
severity: normal
stage: needs patch
status: open
title: _FAST opcodes do no range checking
type: crash
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29046/crashy2.py

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



[issue17190] _FAST opcodes do no range checking

2013-02-11 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 It could be that this is not an interesting bug,
 that policy suggests that anyone who can write their 
 own bytecode is a Consenting Adult.

Yes, that is correct on all counts.

Sorry, this is an *ancient* discussion, long ago put to bed.

Besides, did you really want to kill the performance of our fastest opcodes in 
everyone's code just to save a bytecode hacker from shooting him/herself in the 
foot?

--
nosy: +rhettinger
resolution:  - invalid
status: open - closed

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



[issue1518] Fast globals/builtins access (patch)

2013-02-11 Thread Antoine Pitrou

Antoine Pitrou added the comment:

See issue 10401.
Quoting myself: “Here is the Nth patch for a globals/builtins cache. As other 
caches at the same kind, it shows very small to no gain on non-micro 
benchmarks, showing that contrary to popular belief, globals/builtins lookup 
are not a major roadblock in today's Python performance.”

--

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



[issue4591] 32-bits unsigned user/group identifier

2013-02-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3893ab574c55 by Serhiy Storchaka in branch '3.2':
Issue #4591: Uid and gid values larger than 2**31 are supported now.
http://hg.python.org/cpython/rev/3893ab574c55

New changeset 035cbc654889 by Serhiy Storchaka in branch '2.7':
Issue #4591: Uid and gid values larger than 2**31 are supported now.
http://hg.python.org/cpython/rev/035cbc654889

--

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