[issue1185124] pydoc doesn't find all module doc strings
Sunny K added the comment: Hi Victor, can you give this another look? -- versions: +Python 3.5 -Python 2.7, Python 3.2, Python 3.3 ___ Python tracker <http://bugs.python.org/issue1185124> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1185124] pydoc doesn't find all module doc strings
Changes by Sunny K : Removed file: http://bugs.python.org/file31844/myfirst.patch ___ Python tracker <http://bugs.python.org/issue1185124> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api
Sunny K added the comment: Hi Stefan, There is a comment at the top in structseq.c /* Fields with this name have only a field index, not a field name. They are only allowed for indices < n_visible_fields. */ char *PyStructSequence_UnnamedField = "unnamed field"; This is the definition of os.stat_result in posixmodule.c: static PyStructSequence_Field stat_result_fields[] = { {"st_mode","protection bits"}, {"st_ino", "inode"}, {"st_dev", "device"}, {"st_nlink", "number of hard links"}, {"st_uid", "user ID of owner"}, {"st_gid", "group ID of owner"}, {"st_size","total size, in bytes"}, /* The NULL is replaced with PyStructSequence_UnnamedField later. */ {NULL, "integer time of last access"}, {NULL, "integer time of last modification"}, {NULL, "integer time of last change"}, {"st_atime", "time of last access"}, {"st_mtime", "time of last modification"}, {"st_ctime", "time of last change"}, {"st_atime_ns", "time of last access in nanoseconds"}, {"st_mtime_ns", "time of last modification in nanoseconds"}, {"st_ctime_ns", "time of last change in nanoseconds"}, ... By visible i mean the values present in the repr of the object and by-extension accessible by position. I talked about my problems with os.stat_result in points 3 and 4 of msg202333 i.e repr of os.stat_result takes the first three keys from the attribute-access only fields (the invisible part) and uses them for the last three values in the displayed structseq. With my current patch, _fields for os.stat_result only has 7 values: >>> x = os.stat('.') >>> x._fields ('st_mode', 'st_ino', 'st_dev', 'st_nlink', 'st_uid', 'st_gid', 'st_size') >>> Is this what you expect? -- ___ Python tracker <http://bugs.python.org/issue1820> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api
Sunny K added the comment: Hi Stefan, I've added a new patch which only adds _fields, combining parts from my earlier patch and Andrew's (his patch does not account for visible unnamed fields). -- Added file: http://bugs.python.org/file35367/structseq_fields.patch ___ Python tracker <http://bugs.python.org/issue1820> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21555] gcmodule.c could use pytime.h
Changes by Sunny K : -- nosy: +sunfinite ___ Python tracker <http://bugs.python.org/issue21555> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api
Sunny K added the comment: Oops, the correct issue for improving the repr is issue11698. -- ___ Python tracker <http://bugs.python.org/issue1820> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11698] Improve repr for structseq objects to show named, but unindexed fields
Sunny K added the comment: The previous patch had a wrong mapping between keys and values. The current implementation of repr means that duplicated keys will be present when invisible fields are included. See points 2 and 3 in http://bugs.python.org/issue1820#msg202330 for more explanation. I have sidestepped that issue by placing invisible fields under the dict argument. This also plays well with the current code in structseq_new and eval(repr(obj)) works. The output with the patch is: $./python -c "import os; print(os.stat('LICENSE'))" os.stat_result(st_mode=33188, st_ino=577299, st_dev=64512, st_nlink=1, st_uid=33616, st_gid=600, st_size=12749, st_atime=1382696747, st_mtime=1382361968, st_ctime=1382361968, dict={'st_atime':1382696747.0, 'st_mtime':1382361968.0, 'st_ctime':1382361968.0, 'st_atime_ns':13826967470, 'st_mtime_ns':13823619680, 'st_ctime_ns':13823619680, 'st_blksize':4096, 'st_blocks':32, 'st_rdev':0}) -- Added file: http://bugs.python.org/file32527/structseq_2.patch ___ Python tracker <http://bugs.python.org/issue11698> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11698] Improve repr for structseq objects to show named, but unindexed fields
Changes by Sunny K : Removed file: http://bugs.python.org/file32265/structseq.patch ___ Python tracker <http://bugs.python.org/issue11698> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api
Sunny K added the comment: New patch for 3.4 adds the following: 1. _fields 2. _replace() 3. _asdict() 4. eval(repr(s)) == s Now the issues: 1. _asdict() returns a normal dictionary. I don't know if this is what is required. 2. Both _asdict() and _replace() assume that unnamed visible fields are at the end of the visible sequence. A comment at the beginning says they are allowed for indices < n_visible_fields. Is there another way to map members to values? Because tp->members is (visible named fields + invisible named fields) whereas values array is (visible named fields + visible unnamed fields + invisible named fields) 3. The mismatch mentioned above is present in the current implementation of repr: In os.stat_result, the last three visible fields are unnamed (i.e integer a_time, m_time and c_time). However they are present in the repr output with keys which are the first three keys from the invisible part(float a_time, m_time and c_time). Was this intentional? Also, the above logic causes duplicate keys when invisible fields are included in the repr output as per issue11629. In my patch for that issue, i put invisible fields under the 'dict' keyword argument. This output format utilises code already present in structseq_new and makes eval work as expected when invisible fields are present in repr. Also, it sidesteps the question of duplicated keys because they are present inside a dict. 4. Raymond stated that _fields should contain only the visible positional fields. So _fields of os.stat_result contains only 7 fields because of the three unnamed fields. Is this the expected implementation? 5. Is there a way to declare a member function in C that accepts only keyword arguments(like _replace())? I could not find one. This is my first real C patch. So some of the issues might just be a lack of understanding. Apologies. -- keywords: +patch nosy: +sunfinite Added file: http://bugs.python.org/file32525/structseq_1.patch ___ Python tracker <http://bugs.python.org/issue1820> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19340] test_sysconfig.test_srcdir fails when sys.base_prefix="/"
Changes by Sunny K : -- nosy: +tarek ___ Python tracker <http://bugs.python.org/issue19340> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19340] test_sysconfig.test_srcdir fails when sys.base_prefix="/"
Changes by Sunny K : -- keywords: +patch Added file: http://bugs.python.org/file32314/test_sysconfig.patch ___ Python tracker <http://bugs.python.org/issue19340> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7757] sys.path is incorrect when prefix is ""
Sunny K added the comment: I took a shot at this. Build is successful and imports happen. Tests are ok except test_sysconfig, and that is because of sys.prefix being set to '/'. I've raised issue19340 for that. About the patch, i'm not sure how to completely test for false positives(joinpath now returns if is null). I could not think of any issues from the current calls to joinpath. -- keywords: +patch nosy: +sunfinite Added file: http://bugs.python.org/file32293/getpath.patch ___ Python tracker <http://bugs.python.org/issue7757> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19340] test_sysconfig.test_srcdir fails when sys.base_prefix="/"
New submission from Sunny K: While working on issue7757, i noticed that test_srcdir fails when python is built with prefix "". This is because in Lib/sysconfig.py, _safe_realpath() is called on srcdir which normalises //lib to /lib. In the test case, it is compared directly to the output of get_makefile_filename(). == FAIL: test_srcdir (__main__.TestSysConfig) -- Traceback (most recent call last): File "/lib/python3.4/test/test_sysconfig.py", line 356, in test_srcdir srcdir) AssertionError: '//lib/python3.4/config-3.4dm' != '/lib/python3.4/config-3.4dm' - //lib/python3.4/config-3.4dm ? - + /lib/python3.4/config-3.4dm ~/cpython$ python3.4 Python 3.4.0a3+ (default:dad1debba93c+, Oct 22 2013, 02:32:50) [GCC 4.4.3] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.prefix '/' >>> sys.base_prefix '/' >>> -- components: Tests messages: 200849 nosy: sunfinite priority: normal severity: normal status: open title: test_sysconfig.test_srcdir fails when sys.base_prefix="/" type: behavior versions: Python 3.4 ___ Python tracker <http://bugs.python.org/issue19340> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11698] Improve repr for structseq objects to show named, but unindexed fields
Sunny K added the comment: Added patch for 3.4. The patch demarcates the output by adding a {...} around the dictionary portion. Please let me know if this is the right format or if not required at all. It is a simple change. -- nosy: +sunfinite Added file: http://bugs.python.org/file32265/structseq.patch ___ Python tracker <http://bugs.python.org/issue11698> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14680] pydoc with -w option does not work for a lot of help topics
Sunny K added the comment: This issue is present in 3.4 too. Added patch for 3.4. -- keywords: +patch nosy: +sunfinite versions: +Python 3.4 Added file: http://bugs.python.org/file32258/pydoc.patch ___ Python tracker <http://bugs.python.org/issue14680> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com