[issue32506] dataclasses: no need for OrderedDict now that dict guarantees to keep insertion order

2018-01-06 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +Library (Lib) dependencies: +Dict order is now guaranteed, so add tests and doc for it ___ Python tracker

[issue32503] Avoid creating small frames in pickle protocol 4

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 5127 makes frames be created only when the size of the payload is not less than 4. Since the minimal size of 3 chunks is 3 bytes this is the absolute minimum of frame size. It would be better to count the number of chunks

[issue32503] Avoid creating small frames in pickle protocol 4

2018-01-06 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +4988 stage: -> patch review ___ Python tracker ___

[issue32507] Change Windows install to applocal UCRT

2018-01-06 Thread Steve Dower
Steve Dower added the comment: The PR is ready, but I'll leave this open for a few days in case anyone wants to comment. -- ___ Python tracker

[issue32501] Documentation for dir([object])

2018-01-06 Thread Matthew Cowles
Matthew Cowles added the comment: My thanks to David for the clarification. I don't find the logic he describes (but does not necessarily subscribe to!) persuasive in this case. In my opinion, "Let's be incorrect for the sake of simplicity," is not the way to

[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-06 Thread Guido van Rossum
Guido van Rossum added the comment: Ah, I like dropping "For objects that do not provide sequence protocol". Go for it! -- ___ Python tracker

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Tim Peters
Tim Peters added the comment: And I somehow managed to unsubscribe Steven :-( -- nosy: +steven.daprano ___ Python tracker ___

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Tim Peters
Tim Peters added the comment: Right, "..." immediately after a ">>>" line is taken to indicate a code continuation line, and there's no way to stop that short of rewriting the parser. The workaround you already found could be made more palatable if you weren't determined to

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oops, somehow managed to accidentally unsubscribe r.david.murray -- nosy: +r.david.murray ___ Python tracker

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Here's a simple demonstration of the issue: # --- cut %< --- import doctest def hash_files(): """ >>> hash_files() # doctest: +ELLIPSIS ... d41d8cd98f00b204e9800998ecf8427e __init__.py ... """

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread R. David Murray
R. David Murray added the comment: Ah, I see my answer crossed with your post :) -- ___ Python tracker ___

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread R. David Murray
R. David Murray added the comment: What happens if you print a placeholder line first, before your test output? I'm not sure it will work, I seem to remember something about an ellipses starting a line just not being supported, but it was a long time ago... So, that

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Jason R. Coombs
Jason R. Coombs added the comment: I did find [this ugly workaround](https://github.com/jaraco/jaraco.financial/commit/9b866ab7117d1cfc26d7cdcec10c63a608662b46): >>> print('x' + res) x... -- ___ Python tracker

[issue32509] doctest syntax ambiguity between continuation line and ellipsis

2018-01-06 Thread Jason R. Coombs
New submission from Jason R. Coombs : I'm trying to write a doctest that prints the hash and filename of a directory. The input is the test dir, but due to the unordered nature of file systems, the doctest checks for one known file: def hash_files(root): """

[issue32508] Problem while reading back from a list of lists

2018-01-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: It isn't clear to me what bug you are reporting here: - What do you mean by "problem reading back from a list of lists"? What sort of problem? - What makes you think that there is a bug in the interpreter, rather than in your

[issue32508] Problem while reading back from a list of lists

2018-01-06 Thread J Viswanathan
New submission from J Viswanathan : Please see the attached source file, the related data file and the log file. When run with python hksu_copy.py check_su.dat the following is the output (which is incorrect): -*- mode: compilation; default-directory: "c:/Users/J

[issue32501] Documentation for dir([object])

2018-01-06 Thread R. David Murray
R. David Murray added the comment: I'm not sure, but the discussion I remember was that it would require changes to an awful lot of places in the docs that would make the docs harder to read. It is very seldom in normal Python coding that an object has a method that it

[issue32282] When using a Windows XP compatible toolset, `socketmodule.c` fails to build

2018-01-06 Thread Roundup Robot
Change by Roundup Robot : -- pull_requests: +4987 ___ Python tracker ___

[issue32282] When using a Windows XP compatible toolset, `socketmodule.c` fails to build

2018-01-06 Thread Steve Dower
Steve Dower added the comment: New changeset af11a15c586e980a157c04ee60b6e33dc7228f3f by Steve Dower (Max Bélanger) in branch 'master': bpo-32282: Remove unnecessary check for `VersionHelpers.h` in `socketmodule.c` on Windows

[issue28747] Expose SSL_CTX_set_cert_verify_callback

2018-01-06 Thread Steve Dower
Steve Dower added the comment: The change to make OpenSSL a separate DLL (on Windows, at least, which is all I really care about) means this function is available via ctypes. That's good enough for me, so I'll close this. -- resolution: -> out of date stage:

[issue29409] Implement PEP 529 for io.FileIO

2018-01-06 Thread Steve Dower
Change by Steve Dower : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

[issue28888] Installer fails when newer version of CRT is pending installation

2018-01-06 Thread Steve Dower
Steve Dower added the comment: This will be fixed by the change for 3.7, and it's enough of an edge case for 3.6 that I'm okay with not fixing it. -- resolution: -> out of date stage: needs patch -> resolved status: open -> closed superseder: -> Change

[issue32507] Change Windows install to applocal UCRT

2018-01-06 Thread Steve Dower
Change by Steve Dower : -- keywords: +patch pull_requests: +4984 stage: needs patch -> patch review ___ Python tracker ___

[issue32507] Change Windows install to applocal UCRT

2018-01-06 Thread Steve Dower
Change by Steve Dower : -- keywords: +patch, patch pull_requests: +4984, 4985 stage: needs patch -> patch review ___ Python tracker

[issue29911] Uninstall command line in Windows registry does not uninstall

2018-01-06 Thread Steve Dower
Change by Steve Dower : -- keywords: +patch pull_requests: +4986 stage: -> patch review ___ Python tracker ___

[issue31148] Can we get an MSI installer for something past 3.4.4?

2018-01-06 Thread Steve Dower
Steve Dower added the comment: It is standard procedure for us to stop producing binary releases when a version switches to security-only mode. The burden on our volunteers would become overwhelming otherwise. If you'd like to propose a change to this policy, start by

[issue32428] dataclasses: make it an error to have initialized non-fields in a dataclass

2018-01-06 Thread Eric V. Smith
Eric V. Smith added the comment: Correct. I'm working on that one now. I'll open it tonight or tomorrow. -- ___ Python tracker ___

[issue32428] dataclasses: make it an error to have initialized non-fields in a dataclass

2018-01-06 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: @Eric > I'm closing this, and will open another issue to raise an error for: ... I think we also need a separate issue for not overriding __repr__ etc, if '__repr__' in cls.__dict__. -- ___

[issue25546] python 3.5 installation problem; Error 0x80240017: Failed to execute MSU package

2018-01-06 Thread Steve Dower
Change by Steve Dower : -- resolution: -> out of date stage: -> resolved status: open -> closed superseder: -> Change Windows install to applocal UCRT ___ Python tracker

[issue25954] Python 3.5.1 installer fails on Windows 7

2018-01-06 Thread Steve Dower
Change by Steve Dower : -- resolution: -> out of date stage: -> resolved status: open -> closed superseder: -> Change Windows install to applocal UCRT ___ Python tracker

[issue32507] Change Windows install to applocal UCRT

2018-01-06 Thread Steve Dower
New submission from Steve Dower : There's enough instability due to using the proper UCRT installer (e.g. issue25546, issue25954, also others not reported on bpo) and good enough install base that we can simplify things by just installing it locally on machines that

[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Note that many other PySequence_* functions support only sequences. For example PySequence_Count(o1, o2) is the equivalent of the Python expression o1 + o2 only if o1 is a sequence. If pass integer objects to PySequence_Count()

[issue32428] dataclasses: make it an error to have initialized non-fields in a dataclass

2018-01-06 Thread Eric V. Smith
Eric V. Smith added the comment: I'm closing this, and will open another issue to raise an error for: @dataclass class C: x = field() -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker

[issue32505] dataclasses: make field() with no annotation an error

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- versions: +Python 3.7 ___ Python tracker ___ ___

[issue32506] dataclasses: no need for OrderedDict now that dict guarantees to keep insertion order

2018-01-06 Thread Eric V. Smith
New submission from Eric V. Smith : There are several places where OrderedDict escapes from dataclasses. Switching to dict means we don't have to use OrderedDict forever. For the 3.6 backport, I'm also going to use dict. I saw an analysis (from Raymond, maybe?) that says

[issue32505] dataclasses: make field() with no annotation an error

2018-01-06 Thread Eric V. Smith
New submission from Eric V. Smith : This is an attractive nuisance, especially when coming from attrs. Make it an error, since it's using field() with no annotation: @dataclass class C: x = field() -- assignee: eric.smith messages: 309586 nosy: eric.smith,

[issue32441] os.dup2 should return the new fd

2018-01-06 Thread Xavier de Gaye
Xavier de Gaye added the comment: Good catch, the code makes much more sense now :-) -- ___ Python tracker ___

[issue32279] Pass keyword arguments from dataclasses.make_dataclass() to @dataclass.

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> behavior ___ Python tracker

[issue32279] Pass keyword arguments from dataclasses.make_dataclass() to @dataclass.

2018-01-06 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset d80b443f02e087dd289ffefd04179c675304d76d by Eric V. Smith in branch 'master': bpo-32279: Add additional params to make_dataclass(), pass through to dataclass(). (gh-5117)

[issue32279] Pass keyword arguments from dataclasses.make_dataclass() to @dataclass.

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- pull_requests: +4983 ___ Python tracker ___ ___

[issue32279] Pass keyword arguments from dataclasses.make_dataclass() to @dataclass.

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +4982 stage: -> patch review ___ Python tracker ___

[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2018-01-06 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Jan 6, 2018, at 13:33, Zachary Ware wrote: > > I notice that my 'Installed' builder > (http://buildbot.python.org/all/#/builders/103) has been broken since PR4911 > landed. My suspicion is that it's just

[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-06 Thread Guido van Rossum
Guido van Rossum added the comment: Since docs and implementation disagree let's call it undefined. I really can't comment on what PyPy should do. -- ___ Python tracker

[issue32278] Allow dataclasses.make_dataclass() to omit type information

2018-01-06 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset ed7d429ebb591f65cef558760fb4ebdc4fc8f8b0 by Eric V. Smith in branch 'master': bpo-32278: Allow dataclasses.make_dataclass() to omit type information. (gh-5115)

[issue32278] Allow dataclasses.make_dataclass() to omit type information

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2018-01-06 Thread Brett Cannon
Brett Cannon added the comment: I bet Barry forgot to add some test directories to the makefile. On Sat, Jan 6, 2018, 10:33 Zachary Ware, wrote: > > Zachary Ware added the comment: > > I notice that my 'Installed' builder ( >

[issue32441] os.dup2 should return the new fd

2018-01-06 Thread Benjamin Peterson
Benjamin Peterson added the comment: I suspect the dup3_works variable is supposed to be static. -- ___ Python tracker ___

[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-06 Thread Michał Górny
Michał Górny added the comment: Well, my two main concerns are: 1) whether it is acceptable for PyPy to not raise TypeError in this case, or if I should report it to PyPy upstream as a bug, 2) and whether programmers can appropriately rely on PySequence_Length() raising

[issue32501] Documentation for dir([object])

2018-01-06 Thread Matthew Cowles
Matthew Cowles added the comment: If David is right and people have previously decided not to change wording like this, can someone explain why? As it stands, the meaning is clear and incorrect. -- nosy: +mdcowles

[issue32504] Wheel failed include data_files

2018-01-06 Thread Benjamin Peterson
Benjamin Peterson added the comment: Please report to the wheel maintainers at https://github.com/pypa/wheel -- nosy: +benjamin.peterson resolution: -> third party stage: -> resolved status: open -> closed ___ Python tracker

[issue32450] non-descriptive variable name

2018-01-06 Thread Benjamin Peterson
Change by Benjamin Peterson : -- resolution: -> wont fix stage: -> resolved status: open -> closed ___ Python tracker ___

[issue32278] Allow dataclasses.make_dataclass() to omit type information

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- pull_requests: +4981 ___ Python tracker ___ ___

[issue32450] non-descriptive variable name

2018-01-06 Thread Yuri Kanivetsky
Yuri Kanivetsky added the comment: Well, it's just that I was digging into Python's code. And it took me quite a while to figure out what the variable holds. Running into "ndots" name clarified that. That generally means that variable name doesn't describe its

[issue31148] Can we get an MSI installer for something past 3.4.4?

2018-01-06 Thread Gregory Szorc
Gregory Szorc added the comment: I was going to update some CI that tests all supported versions of Python and pins the Python 3 versions. That CI was previously using the MSI installers for Python 3.4. To my surprise, the MSIs stopped being generated after the 3.4.4

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > What do you mean? Large bytes and strings was written inside a frame when serialize by dumps(). dump() (as well as Python implementations of dumps() and dump()) write them outside of a frame. --

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 5114 implements this when serialize in C into memory. -- resolution: fixed -> stage: resolved -> patch review status: closed -> open ___ Python tracker

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Humm, this feature doesn't work with C implementation. What do you mean? -- ___ Python tracker ___

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +4980 ___ Python tracker ___ ___

[issue32504] Wheel failed include data_files

2018-01-06 Thread atya
New submission from atya : Hi, I created a wheel using python3.4 install bdist_wheel command. I have data dir and in contains files Test.png. in setup.py I added data_files=[ ('/usr/share', ['data/Test.png']) ] when I am instaating the wheel the data

[issue31340] Use VS 2017 compiler for build

2018-01-06 Thread Christoph Gohlke
Christoph Gohlke added the comment: > Have you confirmed that's a problem? No, I have not noticed any problems yet with with Python 3.7.0a3 and many extensions built with VS2017.5. -- ___ Python tracker

[issue9325] Add an option to pdb/trace/profile to run library module as a script

2018-01-06 Thread Mario Corchero
Mario Corchero added the comment: pdb and cProfile are covered. If no one is working on it, do you want me try to put through a patch for "profile" and "trace"? Should I create a separate issue if so? >From Issue 17473 it will leave only: doctest: Which might be

[issue32498] urllib.parse.unquote raises incorrect errormessage when string parameter is bytes

2018-01-06 Thread stein-k
stein-k added the comment: The message is incorrect for the input to the function, and confusing because the caller did supply a bytes-like object. The exception is from an implementation detail, and if the implementation changes the exception could as well. I

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Humm, this feature doesn't work with C implementation. -- ___ Python tracker ___

[issue32503] Avoid creating small frames in pickle protocol 4

2018-01-06 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Pickle protocol 4 uses framing for reducing the overhead of calling the read() method for small chunks of data. Most read chunks are small -- opcodes, small integers, short strings, etc, and calling read() for every 1 or 4

[issue32248] Port importlib_resources (module and ABC) to Python 3.7

2018-01-06 Thread Zachary Ware
Zachary Ware added the comment: I notice that my 'Installed' builder (http://buildbot.python.org/all/#/builders/103) has been broken since PR4911 landed. My suspicion is that it's just another directory missed in the Makefile install libinstall target, but haven't

[issue32502] uuid1() broken on macos high sierra

2018-01-06 Thread Andres Petralli
Andres Petralli added the comment: Here's the output from my system. This is a Mac Pro with a firewire port. Looks as if the address was picked up from fw0: actually, not lo0. Guess _find_mac just iterates until it hits a matching word for a hw address: lo0:

[issue32427] Rename and expose dataclasses._MISSING

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- status: open -> closed ___ Python tracker ___ ___

[issue32499] Add dataclasses.is_dataclass(obj)

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue32499] Add dataclasses.is_dataclass(obj)

2018-01-06 Thread Eric V. Smith
Eric V. Smith added the comment: New changeset e7ba013d870012157f695ead7e3645c2828a7fc5 by Eric V. Smith in branch 'master': bpo-32499: Add dataclasses.is_dataclass(obj), which returns True if obj is a dataclass or an instance of one. (#5113)

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Olivier Grisel
Olivier Grisel added the comment: Thanks for the very helpful feedback and guidance during the review. -- ___ Python tracker

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: Definitely! Thank you for your contribution :-) -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Olivier Grisel
Olivier Grisel added the comment: Shall we close this issue now that the PR has been merged to master? -- ___ Python tracker

[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-06 Thread Guido van Rossum
Guido van Rossum added the comment: If we were to take the docs literally then PySequence_{Size,Length} should just be aliases for PyObject_Size. But I'm reluctant to change something that has been like this for ages. In fact maybe we should deprecate them, together with

[issue32502] uuid1() broken on macos high sierra

2018-01-06 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: On Jan 6, 2018, at 11:26, Andres Petralli wrote: > > Traceback (most recent call last): > File "/Users/andy/Desktop/test.py", line 3, in >str(uuid.uuid1()) > File >

[issue17763] test_pydoc fails with the installed testsuite

2018-01-06 Thread Mark Lawrence
Change by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___

[issue17763] test_pydoc fails with the installed testsuite

2018-01-06 Thread Petr Viktorin
Petr Viktorin added the comment: This is caused by Brailcom's Speech Dispatcher, whose config script ran optparse on import. Apparently it was fixed in their version 0.8.6. Some references: https://github.com/brailcom/speechd/commit/1808ea1a6e840951ffde61e5a6476ccfc118ab5a

[issue32502] uuid1() broken on macos high sierra

2018-01-06 Thread Andres Petralli
New submission from Andres Petralli : uuid.py is getting a 64 bit hardware address for the loopback adapter in High Sierra, specifically in _ifconfig_getnode(). The function expects a 48 bit mac address, but is instead getting 64 bits back and converting it to an int

[issue32499] Add dataclasses.is_dataclass(obj)

2018-01-06 Thread Eric V. Smith
Eric V. Smith added the comment: I've updated the PEP, too. -- ___ Python tracker ___

[issue32501] Documentation for dir([object])

2018-01-06 Thread Eric V. Smith
Eric V. Smith added the comment: It's described here: https://docs.python.org/3/reference/datamodel.html#special-lookup Maybe we should have a glossary entry for "special method lookup", and somehow link mentions like __dir__ to it? This is slightly different from

[issue32499] Add dataclasses.is_dataclass(obj)

2018-01-06 Thread Eric V. Smith
Change by Eric V. Smith : -- keywords: +patch pull_requests: +4979 stage: -> patch review ___ Python tracker ___

[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 3cd7c6e6eb43dbd7d7180503265772a67953e682 by Serhiy Storchaka (Olivier Grisel) in branch 'master': bpo-31993: Do not allocate large temporary buffers in pickle dump. (#4353)

[issue32501] Documentation for dir([object])

2018-01-06 Thread R. David Murray
R. David Murray added the comment: This is a general property of dunder methods in python3, and I think we have chosen not to change the wording when this has come up in other contexts. I'm not sure, though. -- nosy: +r.david.murray

[issue32441] os.dup2 should return the new fd

2018-01-06 Thread Xavier de Gaye
Xavier de Gaye added the comment: Both the change in my previous post or using a definition for 'res' are not needed if 'dup3_works' is removed. That would make the code more clear for both gcc and a human reader. The attached patch removes it. Using a definition for 'res'

[issue32206] Run modules with pdb

2018-01-06 Thread Nick Coghlan
Nick Coghlan added the comment: Re-opening for the CLI help updates. -- resolution: fixed -> stage: resolved -> needs patch status: closed -> open ___ Python tracker

[issue31340] Use VS 2017 compiler for build

2018-01-06 Thread Steve Dower
Steve Dower added the comment: Have you confirmed that's a problem? There are new compatibility promises that did not exist for earlier versions of the runtime, but that does not mean there are no bugs. -- ___ Python

[issue29086] Document C API that is not part of the limited API

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I have found that there is an option :stableabi: for C API elements. But it is not used in the documentation. Shouldn't we start to use it? -- ___ Python tracker

[issue32206] Run modules with pdb

2018-01-06 Thread Mario Corchero
Change by Mario Corchero : -- pull_requests: +4978 ___ Python tracker ___ ___

[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Agreed, it looks either mistaken or confusing. This wording is used from the first versions of the C API documentation. I don't know what is meant here. -- assignee: -> docs@python components: +Documentation -Extension

[issue32501] Documentation for dir([object])

2018-01-06 Thread Vladislavs Burakovs
New submission from Vladislavs Burakovs : Documentation page [1] says "If the object has a method named __dir__(), this method will be called and must return the list of attributes.". It seems that on Python 3.6 it only works if the *class* has a method named

[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-06 Thread Michał Górny
Michał Górny added the comment: So is the documentation mistaken or just confusing? It says straight: > For objects that do not provide sequence protocol, this is equivalent to the > Python expression len(o). So it the 'do not' mistaken or does it mean objects that are

[issue32500] PySequence_Length() raises TypeError on dict type

2018-01-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PySequence_Length(o) is equivalent to the Python expression len(o) only if o is a sequence. dict is not a sequence. You must use a correct API: PyObject_Size() -- for general objects. PyMapping_Size() -- if the object is a