[issue25205] setattr accepts invalid identifiers

2018-10-29 Thread STINNER Victor
STINNER Victor added the comment: I created bpo-35105 to propose to document the behavior. -- ___ Python tracker ___ ___

[issue25205] setattr accepts invalid identifiers

2018-10-29 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> not a bug stage: -> resolved status: pending -> closed ___ Python tracker ___ ___

[issue25205] setattr accepts invalid identifiers

2018-04-22 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- status: open -> pending ___ Python tracker ___

[issue25205] setattr accepts invalid identifiers

2015-09-23 Thread eryksun
eryksun added the comment: Even MvL appears to slip up when he states "some may accept non-strings as attribute names". That would be pointless in a __setattr__ method since setattr / PyObject_SetAttr reject non-string values as 'names'. -- ___

[issue25205] setattr accepts invalid identifiers

2015-09-23 Thread R. David Murray
R. David Murray added the comment: I did however make the same mistake without checking the docs or the behavior. But the fact that I didn't look at it doesn't make the current documentation wrong :) What change is it that you think would be beneficial? --

[issue25205] setattr accepts invalid identifiers

2015-09-22 Thread W deW
W deW added the comment: Thanks for the ref to issue14029. I think I see how it works. As long as the object's __dict__ accepts the attributeName as a key, it needs not be a valid string nor a string at all. Though the latter *is* checked for, and that in turn can be circumvented by adding

[issue25205] setattr accepts invalid identifiers

2015-09-22 Thread eryksun
eryksun added the comment: This is a documentation issue and not specific to a particular version of Python. What's the rule on version tagging in this case? -- components: +Documentation ___ Python tracker

[issue25205] setattr accepts invalid identifiers

2015-09-22 Thread Martin Panter
Martin Panter added the comment: Eryksun: If you mean tagging the bug report, I think we usually tag all the applicable open branches that are due for another release. I’m not sure anything needs to be documented regarding setattr(). At best it is an implementation detail that should not be

[issue25205] setattr accepts invalid identifiers

2015-09-21 Thread Martin Panter
Martin Panter added the comment: Previous report: Issue 14029 -- nosy: +martin.panter ___ Python tracker ___

[issue25205] setattr accepts invalid identifiers

2015-09-21 Thread STINNER Victor
STINNER Victor added the comment: Even if it's not well document, it's legit and supported by CPython, but it may not be supported by other Python implementation (ex: PyPy). -- nosy: +haypo ___ Python tracker

[issue25205] setattr accepts invalid identifiers

2015-09-21 Thread W deW
New submission from W deW: An identifier is defined by identifier ::= (letter|"_") (letter | digit | "_")* setattr accepts identifiers that do not meet this criterion: Python 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or

[issue25205] setattr accepts invalid identifiers

2015-09-21 Thread eryksun
eryksun added the comment: To clarify using a unicode name in 2.x, it has to be encodable using the default encoding, sys.getdefaultencoding(). Normally this is ASCII. -- ___ Python tracker

[issue25205] setattr accepts invalid identifiers

2015-09-21 Thread eryksun
eryksun added the comment: The name can be any str/unicode string, including language keywords: >>> setattr(o, 'def', 'allowed') >>> getattr(o, 'def') 'allowed' >>> o.def File "", line 1 o.def ^ SyntaxError: invalid syntax and even an empty