[issue23934] inspect.signature reporting "()" for all builtin & extension types

2015-04-13 Thread James Powell

James Powell added the comment:

See attached patch for unittest.

For 3.4, test that inspect.signature(str) raises TypeError.

For >3.5, this can be improved to use _testcapi.matmulType

--
Added file: http://bugs.python.org/file38949/issue_23934-test.patch

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



[issue23934] inspect.signature reporting "()" for all builtin & extension types

2015-04-13 Thread James Powell

James Powell added the comment:

Discussed with Nick Coghlan.

See attached patch to return `signature(object)` only if both `__new__` and 
`__init__` are shared with `object`.

Otherwise, raise TypeError indicating built-in types not supported. 

https://docs.python.org/3/library/inspect.html#inspect.signature
"Raises ValueError if no signature can be provided, and TypeError if that type 
of object is not supported."

--
keywords: +patch
Added file: http://bugs.python.org/file38936/issue_23934.patch

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



[issue17380] initproc return value is unclear

2015-04-12 Thread James Powell

Changes by James Powell :


--
nosy: +r.david.murray

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



[issue17380] initproc return value is unclear

2015-04-12 Thread James Powell

James Powell added the comment:

See attached patch to clarify this in the docs.

--
keywords: +patch
Added file: http://bugs.python.org/file38910/issue_17380.patch

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



[issue17380] initproc return value is unclear

2015-04-12 Thread James Powell

Changes by James Powell :


--
nosy: +james

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



[issue10933] Tracing disabled when a recursion error is triggered (even if properly handled)

2015-04-12 Thread James Powell

James Powell added the comment:

We investigated this issue with pdmccormick & r.david.murray.

The behaviour appears to be intentional. If the trace function raises an 
Exception, system tracing is disabled entirely.

See attached documentation patch to clarify this.

--
keywords: +patch
Added file: http://bugs.python.org/file38908/issue_10933.patch

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



[issue10933] Tracing disabled when a recursion error is triggered (even if properly handled)

2015-04-12 Thread James Powell

Changes by James Powell :


--
nosy: +james, r.david.murray

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



[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread James Powell

Changes by James Powell :


Added file: http://bugs.python.org/file32745/decorator-syntax.patch

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



[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-20 Thread James Powell

James Powell added the comment:

I see this as removing a restriction and a special-case from the
decorator syntax (noting, of course, that these were introduced
deliberately.)

In terms of whether the new forms are improvements, my preference is to
leave this up to the judgement of the programmer, moderated of course by
their prevailing coding guide.

I would argue that this change does not force any additional complexity
on the programmer (who is free to take or leave it) or on the
interpreter (- the straightforwardness of the patch corroborates this.)

I would also argue that there are certainly cases where, in the midst of
some large codebase, the dotted_name restriction may seem a bit arbitrary.

This is likely true for:

class Foo:
def bar(self, func):
return func

@staticmethod
def baz(func):
return func

@staticmethod
def quux():
def dec(func):
return func
return dec

# invalid
@Foo().bar
def f(): pass

# valid
@Foo.baz
def f(): pass

# valid
@Foo.quux()
def f(): pass

For completeness' sake, I have attached a patch with an additional unit
test and amended documentation.

Should we proceed with writing a PEP for Python 3.5?

--
Added file: http://bugs.python.org/file32741/decorator-syntax.patch

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



[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-19 Thread James Powell

Changes by James Powell :


--
keywords: +patch
Added file: http://bugs.python.org/file32717/decorator-syntax.patch

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



[issue19660] decorator syntax: allow testlist instead of just dotted_name

2013-11-19 Thread James Powell

New submission from James Powell:

Decorator syntax currently allows only a dotted_name after the @. As far as I 
can tell, this was a gut-feeling decision made by Guido. [1]

I spoke with Nick Coghlan at PyTexas about this, and he suggested that if 
someone did the work, there might be interest in revisiting this restriction.

The attached patch allows any testlist to follow the @.

The following are now valid:

@(lambda x:x)
def f():
pass

@(spam if p else eggs)
def f():
pass

@spam().ham().eggs()
def f():
pass

[1] http://mail.python.org/pipermail/python-dev/2004-August/046711.html

--
components: Interpreter Core
messages: 203456
nosy: james
priority: normal
severity: normal
status: open
title: decorator syntax: allow testlist instead of just dotted_name
type: enhancement
versions: Python 3.4, Python 3.5

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