[issue19145] Inconsistent behaviour in itertools.repeat when using negative times

2013-10-02 Thread Vajrasky Kok
Vajrasky Kok added the comment: The second patch makes the negative number parameter/keyword ALWAYS means 0. -- Added file: http://bugs.python.org/file31944/fix_itertools_repeat_negative_number_means_0.patch ___ Python tracker rep...@bugs.python.org

[issue19145] Inconsistent behaviour in itertools.repeat when using negative times

2013-10-02 Thread Vajrasky Kok
Vajrasky Kok added the comment: Improved the patch which makes negative number *always* means 0. Added comment and put more test. -- Added file: http://bugs.python.org/file31949/fix_itertools_repeat_negative_number_means_0_v2.patch ___ Python

[issue19099] struct.pack fails first time with unicode fmt

2013-10-01 Thread Vajrasky Kok
Vajrasky Kok added the comment: Serhiy, you don't want to clear the cache in the test to simulate the bug? struct._clearcache() Other than that, should we raise struct.error instead of ValueError? Right now, the current behaviour in python 2.7 is: struct.pack('\x80', 3) Traceback (most

[issue19099] struct.pack fails first time with unicode fmt

2013-10-01 Thread Vajrasky Kok
Vajrasky Kok added the comment: Nevermind about my comment about clearing cache. It only happens if we use struct.pack not struct.Struct. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19099

[issue19094] urljoin should raise a TypeError if URL is not a string

2013-10-01 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, attached the patch based on your comment, Senthil Kumaran. Thanks. The reason I use isinstance to check the type is because I want to support the inheritance as much as possible. class new_str(str): ... pass urljoin(new_str('http://python.org

[issue19099] struct.pack fails first time with unicode fmt

2013-09-30 Thread Vajrasky Kok
Vajrasky Kok added the comment: Here's the preliminary patch. I am assuming that we should accept unicode argument not reject it straight away. Python3 does that. import struct struct.pack('b', 3) b'\x03' struct.pack(b'b', 3) b'\x03' struct.pack(b'\xff', 3) Traceback (most recent call last

[issue19099] struct.pack fails first time with unicode fmt

2013-09-30 Thread Vajrasky Kok
Vajrasky Kok added the comment: Refactor test to clear the cache before using unicode format. -- Added file: http://bugs.python.org/file31930/handle_ascii_range_unicode_in_struct_pack_v2.patch ___ Python tracker rep...@bugs.python.org http

[issue19094] urljoin should raise a TypeError if URL is not a string

2013-09-28 Thread Vajrasky Kok
Vajrasky Kok added the comment: I modified the patch to handle the last case using your way as well. Anyway, I found out that urlsplit and urlparse got the same issue as well. urlparse('python.org', b'http://') Traceback (most recent call last): File stdin, line 1, in module File /home

[issue19094] urljoin should raise a TypeError if URL is not a string

2013-09-26 Thread Vajrasky Kok
Vajrasky Kok added the comment: This is the preliminary patch to raise TypeError in that situation. -- keywords: +patch nosy: +vajrasky Added file: http://bugs.python.org/file31876/urljoin_throws_type_error.patch ___ Python tracker rep

[issue19082] Lib/xmlrpc/client.py demo code points to the dead server

2013-09-26 Thread Vajrasky Kok
Vajrasky Kok added the comment: What test_xmlrpc_net tests (especially the one with time.xmlrpc.com) have been tested in test_xmlrpc except for connecting to server with dotted_attribute feature and receiving datetime instance over the network. That test is not that hard to be migrated

[issue19094] urljoin should raise a TypeError if URL is not a string

2013-09-26 Thread Vajrasky Kok
Vajrasky Kok added the comment: What about this one? urljoin(['a'], []) ['a'] urljoin(['a'], ['b']) . omitted .. AttributeError: 'list' object has no attribute 'decode' Is this desirable? Both patches missed this case. Should we only accept str and bytes

[issue19082] Lib/xmlrpc/client.py demo code points to the dead server

2013-09-24 Thread Vajrasky Kok
New submission from Vajrasky Kok: Lib/xmlrpc/client.py tries to connect to http://time.xmlrpc.com/RPC2 which has been dead for a while. I see there is no light in the end of tunnel. Since this code is meant to be a demo not a general purpose tool, I say why don't we direct it to localhost

[issue19082] Lib/xmlrpc/client.py demo code points to the dead server

2013-09-24 Thread Vajrasky Kok
Changes by Vajrasky Kok sky@speaklikeaking.com: Removed file: http://bugs.python.org/file31856/xmlrpc_server_client_demo.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19082

[issue19082] Lib/xmlrpc/client.py demo code points to the dead server

2013-09-24 Thread Vajrasky Kok
Changes by Vajrasky Kok sky@speaklikeaking.com: Added file: http://bugs.python.org/file31857/xmlrpc_server_client_demo.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19082

[issue13404] Add support for system.methodSignature() to XMLRPC Server

2013-09-23 Thread Vajrasky Kok
Vajrasky Kok added the comment: How do you infer the data types for the parameters? I don't think we can, unless we force them to use function annotation. If they don't use that feature, then we say the signature is not supported. The problem is getting deeper if we are talking about return

[issue18985] Improve the documentation in fcntl module

2013-09-16 Thread Vajrasky Kok
Vajrasky Kok added the comment: Updated patch based on Ezio's review. I reverted back the changes to Nul and module documentation (since it is not so clear whether we should categorize flock as Unix routine or not). -- Added file: http://bugs.python.org/file31795

[issue18994] Inside fcntl module, we does not check the return code of all_ins function

2013-09-15 Thread Vajrasky Kok
Vajrasky Kok added the comment: Charles-François Natali, sorry I just noticed Ezio's comment. The all_ins function return -1 on failure and 0 on success. I use this form: if (all_ins(m)) return NULL; because I follow the example in Modules/posixmodule.c. If this form

[issue19025] Deleting attribute of Enum gives misleading error message

2013-09-15 Thread Vajrasky Kok
New submission from Vajrasky Kok: from enum import Enum class MyPet(Enum): ... CUTE_CAT = 1 ... VIGOROUS_DOG = 2 ... UGLY_BLOBFISH = 3 ... PROMISCUOUS_BONOBO = 4 ... def spam(cls): pass ... del MyPet.CUTE_CAT Traceback (most recent call last): File stdin, line 1, in module

[issue19025] Deleting attribute of Enum gives misleading error message

2013-09-15 Thread Vajrasky Kok
Vajrasky Kok added the comment: Here is the patch containing unit test only to confirm existing behaviour. So people can learn what to expect when they delete Enum attributes. Even if we *decide* to change the behaviour of del MyPet.CUTE_CAT (assuming CUTE_CAT is an Enum member), I sense

[issue18993] There is an overshadowed and invalid test in testmock.py

2013-09-14 Thread Vajrasky Kok
Vajrasky Kok added the comment: Michael, attached the patch to accommodate your request. Yeah, I think this is the best way because I have seen no possible solutions to make both tests work without altering them. Xavier, that's cool. I didn't know such tool exists. Usually I found

[issue18993] There is an overshadowed and invalid test in testmock.py

2013-09-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, I found the difference. The second test case is to test the case on which we delete the attribute of the mock instance before being referenced by any variable. The we make sure the attribute is gone for good. The first test case is to test the case

[issue18993] There is an overshadowed and invalid test in testmock.py

2013-09-12 Thread Vajrasky Kok
Vajrasky Kok added the comment: The first test fails. I already tested it. I think they test the same thing, what happens to the attribute of mock instance if you delete it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue18995] Enum does not work with reversed

2013-09-11 Thread Vajrasky Kok
Vajrasky Kok added the comment: Simplified unit test. I reused enum Season in the test class. By the way, there is another way to add support for enum without implementing __reversed__ method, which is adding support indexing by number (in __getitem__ method), e.g. Season[1] = Season.SPRING

[issue18993] There is an overshadowed and invalid test in testmock.py

2013-09-10 Thread Vajrasky Kok
New submission from Vajrasky Kok: In Lib/unittest/test/testmock/testmock.py, there are two test_attribute_deletion. One of them is overshadowed (not executed) by the other. def test_attribute_deletion(self): # this behaviour isn't *useful*, but at least it's now tested

[issue18994] Inside fcntl module, we does not check the return code of all_ins function

2013-09-10 Thread Vajrasky Kok
New submission from Vajrasky Kok: In Modules/fcntlmodule.c, there is a code to insert symbolic constants to the module. all_ins(m); But we don't check the return code of the function whether it is successful or not, unlike in posix module in which we check it. if (all_ins(m

[issue18995] Enum does not work with reversed

2013-09-10 Thread Vajrasky Kok
New submission from Vajrasky Kok: cutecat@amiau:~/cpython$ cat /tmp/innerplanets.py from enum import Enum class innerplanets(Enum): mercury = 1 venus = 2 earth = 3 mars = 4 for planet in innerplanets: print(planet) for planet in reversed(innerplanets): print(planet

[issue18985] Improve the documentation in fcntl module

2013-09-09 Thread Vajrasky Kok
New submission from Vajrasky Kok: The attached patch fixed typos and improved the documentation to improve the clarity in Modules/fcntlmodule.c. Please see the attached patch and feel free to disagree with the improvement. -- assignee: docs@python components: Documentation files

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-09-08 Thread Vajrasky Kok
Vajrasky Kok added the comment: Well, what about None? $ python3 -c 'import csv; reader = csv.reader(foo, delimiter=None)' Traceback (most recent call last): File string, line 1, in module TypeError: delimiter must be set English grammatically speaking, we should get this kind of error

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-09-08 Thread Vajrasky Kok
Vajrasky Kok added the comment: David R. Murray said, 'delimiter must be a 1 character string would cover it.' You mean $ ./python -c 'import csv; reader = csv.reader(foo, delimiter=)' should give this error 'delimiter must be a 1 character string'? Attached the patch to accommodate your

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-09-08 Thread Vajrasky Kok
Vajrasky Kok added the comment: Sorry for typing your name wrongly. s/David R. Murray/R. David Murray/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18829

[issue18973] Use argparse in the calendar module

2013-09-08 Thread Vajrasky Kok
Vajrasky Kok added the comment: I don't see any patches. You forgot to upload the patch? -- nosy: +vajrasky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18973

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-09-08 Thread Vajrasky Kok
Vajrasky Kok added the comment: After contemplating for a while, I am not sure that we should treat empty string for delimiter with error message: 'delimiter must be an 1-character string'. The reason is to keep consistency with quotechar keyword. [sky@localhost cpython]$ ./python -c 'import

[issue18957] PYTHONFAULTHANDLER enables faulthandler when the variable is empty

2013-09-07 Thread Vajrasky Kok
Vajrasky Kok added the comment: Do you mean something like *this*? this - the patch, pythonfaulthandler_env_var.patch. -- keywords: +patch nosy: +vajrasky Added file: http://bugs.python.org/file31641/pythonfaulthandler_env_var.patch ___ Python

[issue18955] Confusing documentation in Lib/importlib/util.py

2013-09-07 Thread Vajrasky Kok
Vajrasky Kok added the comment: That would help. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18955 ___ ___ Python-bugs-list mailing list

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-09-07 Thread Vajrasky Kok
Vajrasky Kok added the comment: I noticed in CPython source code, when we print the type of the object, we use %.200s not %s. For example, in Modules/posixmodule.c: uid should be integer, not %.200s, So the newest path was created to conform with this tradition. Another thing I noticed

[issue18958] Exception('No JSON object could be decoded') when parsing a valid JSON

2013-09-07 Thread Vajrasky Kok
Vajrasky Kok added the comment: a = open('/tmp/input.json') b = a.read() b[0] '\ufeff' import json json.loads(b[1:]) loads just fine json.loads(b) chokes. Whether python json module should handle '\ufeff' gracefully or not, I am not sure. Let me investigate it. -- nosy

[issue18958] Exception('No JSON object could be decoded') when parsing a valid JSON

2013-09-07 Thread Vajrasky Kok
Vajrasky Kok added the comment: The U+FEFF character is related with Byte order mark. Reference: http://en.wikipedia.org/wiki/Byte_Order_Mark -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18958

[issue18953] Typo in NEWS about fixed format specifiers for Py_ssize_t in debugging output in the _sre module

2013-09-06 Thread Vajrasky Kok
New submission from Vajrasky Kok: File Misc/NEWS, line 65 66: - Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in the _sre moduel. moduel = module Related commit: http://hg.python.org/cpython/rev/c41c68a18bb6 -- assignee: docs@python components

[issue18954] Grammatically incorrect sentences in Python/fileutils.c

2013-09-06 Thread Vajrasky Kok
New submission from Vajrasky Kok: In commit about implementation of the PEP 446: file descriptors and file handles are now created non-inheritable, there are some grammatically incorrect sentences in Python/fileutils.c. Please see the patch for details. Related commit: http://hg.python.org

[issue18955] Confusing documentation in Lib/importlib/util.py

2013-09-06 Thread Vajrasky Kok
New submission from Vajrasky Kok: In Lib/importlib/util.py, the documentation is confusing me. Line 42 43: If an exception is raised and the decorator created the module it is subsequently removed from sys.modules. Is it supposed to be: If an exception is raised

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-09-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the patch to accomodate Ezio Melotti's request. The patch now have two separate errors for wrong type and right type, wrong length. Don't we break compatibility by changing the type of exception from TypeError to ValueError? -- Added file

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-09-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: Same as fix_error_message_reader_csv_alternative_1_v4.patch (by Serhiy), but I removed unused variables in the test. -- Added file: http://bugs.python.org/file31614/fix_error_message_reader_csv_alternative_1_v5.patch

[issue18904] Unnecessary test in file descriptor inheritance test

2013-09-01 Thread Vajrasky Kok
New submission from Vajrasky Kok: In Lib/test/test_os.py in class FDInheritanceTests, we have an unnecessary test, which is test_set_inheritable. What test_set_inheritable tests is already being covered by test_get_inheritable. Also, I think test_get_inheritable should be renamed

[issue18745] Test enum in test_json is ignorant of infinity value

2013-09-01 Thread Vajrasky Kok
Vajrasky Kok added the comment: To test the infinity, negative infinity, and NaN (Not a Number), you named the test as test_weird_floats. So implicitely, you admitted that they are floats but just weird. Yet, you named the sample data test class as NotNum. Implicitely, you were saying

[issue18853] Got ResourceWarning unclosed file when running Lib/shlex.py demo

2013-08-27 Thread Vajrasky Kok
New submission from Vajrasky Kok: The python is compiled with --with-pydebug flag. [sky@localhost cpython]$ cat /tmp/quote.txt manly man likes 'cute cat' [sky@localhost cpython]$ ./python Lib/shlex.py /tmp/quote.txt Token: 'manly' Token: 'man' Token: 'likes' Token: '\'cute cat\'' sys:1

[issue18830] Remove duplicates from a result of getclasstree()

2013-08-27 Thread Vajrasky Kok
Vajrasky Kok added the comment: What about if you extend the test coverage as well? Right now, we don't have test to test getclasstree method with unique parameter set to false. -- nosy: +vajrasky ___ Python tracker rep...@bugs.python.org http

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-08-26 Thread Vajrasky Kok
Vajrasky Kok added the comment: Apparently, other attributes of the csv dialect beside delimiter, such as escapechar and quotechar share the same problem. import _csv _csv.reader('foo', quotechar=b'') Traceback (most recent call last): File stdin, line 1, in module TypeError: quotechar

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-08-25 Thread Vajrasky Kok
Vajrasky Kok added the comment: This is the preliminary patch to fix the error message. -- keywords: +patch nosy: +vajrasky Added file: http://bugs.python.org/file31462/fix_error_message_reader_csv.patch ___ Python tracker rep...@bugs.python.org http

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-08-25 Thread Vajrasky Kok
Vajrasky Kok added the comment: This is the second alternative of the patch to fix the error message using different approach. I am not sure which one is better. -- Added file: http://bugs.python.org/file31463/fix_error_message_reader_csv_alternative_1.patch

[issue18829] csv produces confusing error message when passed a non-string delimiter

2013-08-25 Thread Vajrasky Kok
Vajrasky Kok added the comment: I realized there was a test that was similar with my test. I merged them into one test. I think the alternative is better than the original patch so I updated the alternative patch only. -- Added file: http://bugs.python.org/file31467

[issue18799] Resurrect and fix test_404 in Lib/test/test_xmlrpc.py

2013-08-22 Thread Vajrasky Kok
Vajrasky Kok added the comment: Yes, I agree with you, R. David Murray. But there are some reasons why I try to resurrect this dormant test: 1. This test was disabled on 19 January 2008. http://hg.python.org/cpython/rev/859bf85a556a It has been more than 5 years. Many things happened. 2

[issue15204] Deprecate the 'U' open mode

2013-08-22 Thread Vajrasky Kok
Vajrasky Kok added the comment: http://bugs.python.org/review/15204/diff/9032/Tools/iobench/iobench.py Line 10 in New: import io But io module is never used. -- nosy: +vajrasky ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue18747] Re-seed OpenSSL's PRNG after fork

2013-08-22 Thread Vajrasky Kok
Vajrasky Kok added the comment: Some typos on last commit current time (miliseconds or seconds) and an uninitialized arry. should be current time (miliseconds or seconds) and an uninitialized array. instead of a child handler because fork() is suppose to be async-signal should

[issue18817] Got resource warning when running Lib/aifc.py

2013-08-22 Thread Vajrasky Kok
New submission from Vajrasky Kok: The python is compiled with debug option. omittedcpython$ ./python Lib/aifc.py Lib/test/sndhdrdata/sndhdr.aiff Reading Lib/test/sndhdrdata/sndhdr.aiff nchannels = 2 nframes = 5 sampwidth = 2 framerate = 44100 comptype = b'NONE' compname = b'not compressed

[issue18798] Typo and unused variables in test fcntl

2013-08-21 Thread Vajrasky Kok
New submission from Vajrasky Kok: Typo in line 11: # Skip test if no fnctl module. Unused variables rv in test_fcntl_file_descriptor method. Attached the patch to clean up the test. -- components: Tests files: fix_typo_unused_variables_in_test_fcntl.patch keywords: patch messages

[issue18799] Resurrect and fix test_404 in Lib/test/test_xmlrpc.py

2013-08-21 Thread Vajrasky Kok
New submission from Vajrasky Kok: There is a dormant test in Lib/test/test_xmlrpc.py (line 579): # [ch] The test 404 is causing lots of false alarms. def XXXtest_404(self): # send POST with http.client, it should return 404 header and # 'Not Found' message. conn

[issue18787] Misleading error from getspnam function of spwd module

2013-08-20 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the patch to accomodate Serhiy Storchaka's suggestion by using KeyError exception for backward compatibility. -- Added file: http://bugs.python.org/file31382/fix_error_message_getspnam_v2.patch ___ Python

[issue10388] spwd returning different value depending on privileges

2013-08-20 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the patch to raise OSError instead of returning empty list if a normal user uses getspall function of spwd module. I investigated about this issue. There exists situation where /etc/shadow file does not exist: https://bugs.kde.org/show_bug.cgi?id

[issue18787] Misleading error from getspnam function of spwd module

2013-08-20 Thread Vajrasky Kok
Vajrasky Kok added the comment: Sorry about that. Okay, so for now, we wait for other people's suggestion, which way we should use to handle this situation? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18787

[issue18796] Wrong documentation of show_code function from dis module

2013-08-20 Thread Vajrasky Kok
New submission from Vajrasky Kok: $ ./python Python 3.4.0a1+ (default:afb1b4797419, Aug 21 2013, 09:54:46) [GCC 4.7.2] on linux Type help, copyright, credits or license for more information. import dis import sys def spam(x): ... return x * 2 ... dis.show_code(spam, file=sys.stderr) Name

[issue18779] Misleading documentations and comments in regular expression about alphanumerics and underscore

2013-08-19 Thread Vajrasky Kok
New submission from Vajrasky Kok: According to: http://oald8.oxfordlearnersdictionaries.com/dictionary/alphanumeric http://en.wikipedia.org/wiki/Alphanumeric Alphanumeric is defined as [A-Za-z0-9]. Underscore (_) is not one of them. One of the documentation in Python (Doc/tutorial/stdlib2.rst

[issue18779] Misleading documentations and comments in regular expression HOWTO

2013-08-19 Thread Vajrasky Kok
Vajrasky Kok added the comment: In Lib/re.py, starting from line 77 (Python 3.4): \w Matches any alphanumeric character; equivalent to [a-zA-Z0-9_] in bytes patterns or string patterns with the ASCII flag. In string patterns without the ASCII flag

[issue18781] re.escape escapes underscore (Python 2.7)

2013-08-19 Thread Vajrasky Kok
New submission from Vajrasky Kok: $ ./python --version Python 2.7.5+ $ ./python Python 2.7.5+ (2.7:062533327ad2, Aug 19 2013, 22:44:52) [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux2 Type help, copyright, credits or license for more information. import re re.escape('_') '\\_' Python 3.3

[issue18787] Misleading error from getspnam function of spwd module

2013-08-19 Thread Vajrasky Kok
New submission from Vajrasky Kok: As root: $ sudo python3 [sudo] password for ethan: Python 3.2.3 (default, Apr 10 2013, 05:07:54) [GCC 4.7.2] on linux2 Type help, copyright, credits or license for more information. import spwd spwd.getspnam(I_don't_exist) Traceback (most recent call last

[issue18678] Wrong struct members name for spwd module

2013-08-18 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the patch to accommodate R. David Murray's request. Accessing invalid attributes such as sp_nam and sp_pwd from spwd tuple will generate deprecation warning message. Also, I added test function so we can run spwd module directly. This is useful

[issue18768] Wrong documentation of RAND_egd function in ssl module

2013-08-17 Thread Vajrasky Kok
New submission from Vajrasky Kok: import ssl ssl.RAND_egd.__doc__ RAND_egd(path) - bytes\n\nQueries the entropy gather daemon (EGD) on the socket named by 'path'.\nReturns number of bytes read. Raises SSLError if connection to EGD\nfails or if it does provide enough data to seed PRNG

[issue18773] When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, an exception does not report the file descriptor

2013-08-17 Thread Vajrasky Kok
New submission from Vajrasky Kok: When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, an exception does not report which the file descriptor is the problematic one. Attached the patch to put the file descriptor in the aforementioned

[issue18773] When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, an exception does not report the file descriptor

2013-08-17 Thread Vajrasky Kok
Vajrasky Kok added the comment: Same patch, but more pep8 compliant. -- Added file: http://bugs.python.org/file31347/add_file_descriptor_to_exception_signal_set_wakeup_fd_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue18773] When a signal handler fails to write to the file descriptor registered with ``signal.set_wakeup_fd()``, an exception does not report the file descriptor

2013-08-17 Thread Vajrasky Kok
Vajrasky Kok added the comment: Sorry, When I read ... wakeup fd:\n my subconsciousness mind automatically translated it to ... wakeup fd: %d\n. Then you made me realized there is another error message below it. I closed this ticket as invalid. -- resolution: - invalid status: open

[issue18774] There is still last bit of GNU Pth code in signalmodule.c

2013-08-17 Thread Vajrasky Kok
New submission from Vajrasky Kok: I read this commit: http://hg.python.org/cpython/rev/1d5f644b9241 But I noticed there is still GNU Pth code lingering around in Modules/signalmodule.c. Beside of that the WITH_PTH code (in the same file) is expired already. If you configure python

[issue18745] Test enum in test_json is ignorant of infinity value

2013-08-15 Thread Vajrasky Kok
New submission from Vajrasky Kok: Test enum json in Lib/test/test_json/test_enum.py is ignorant of infinity values. Also, NaN, but since NaN is a weirdo, let's not take that into account. The unit test should represent of what will work in every case. For example: def test_floats(self

[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-13 Thread Vajrasky Kok
New submission from Vajrasky Kok: In shorten function of textwrap module, the placeholder becomes a hole where we can inject non-normalized whitespaces to the text. text = Hello there, how are you this fine day? I'm glad to hear it! from textwrap import shorten shorten(text, 40, placeholder

[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, nevermind about non-normalized whitespaces in placeholder, but what about this case? text = Hello there, how are you this fine day? I'm glad to hear it! from textwrap import shorten shorten(text, 10, placeholder= ) 'Hello' shorten(text, 9

[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: Do you want to write a patch? My pleasure. Attached the second version of the patch to accomodate Pitrou's request. -- Added file: http://bugs.python.org/file31274/fix_for_non_normalized_whitespaces_in_placeholder_v2.patch

[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached more refined patch. Removed unnecessary test. Added more robust test. Added shorten in __all__. -- Added file: http://bugs.python.org/file31275/fix_for_non_normalized_whitespaces_in_placeholder_v3.patch

[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-13 Thread Vajrasky Kok
Changes by Vajrasky Kok sky@speaklikeaking.com: Removed file: http://bugs.python.org/file31275/fix_for_non_normalized_whitespaces_in_placeholder_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18723

[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-13 Thread Vajrasky Kok
Changes by Vajrasky Kok sky@speaklikeaking.com: Added file: http://bugs.python.org/file31276/fix_for_non_normalized_whitespaces_in_placeholder_v3.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18723

[issue18725] Multiline shortening

2013-08-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: What about newline keyword argument? Are we forcing the newline to be '\n'? Alternate newlines will be useful for Windows platform ('\r\n') and HTML platform ('br /'). -- ___ Python tracker rep...@bugs.python.org

[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: I missed this case: from textwrap import shorten shorten('hell', 4) Traceback (most recent call last): File stdin, line 1, in module File /home/sky/Code/python/programming_language/cpython/Lib/textwrap.py, line 386, in shorten return w.shorten(text

[issue18723] shorten function of textwrap module is susceptible to non-normalized whitespaces

2013-08-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, attached the fifth version not to care about the case where text is smaller than the placeholder. -- Added file: http://bugs.python.org/file31278/fix_for_non_normalized_whitespaces_in_placeholder_v5.patch

[issue18728] Increased test coverage for filecmp.py

2013-08-13 Thread Vajrasky Kok
Vajrasky Kok added the comment: Hi Alex. Typo in #Speicify subdirectories to hide. I think you should not create WIN32 constant. Use this statement instead: @unittest.skipIf(sys.platform == win32, Not valid on Windows) I think you should use addCleanup if you want to remove the directories

[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-12 Thread Vajrasky Kok
Vajrasky Kok added the comment: Thanks, Benjamin, for reviewing my patch. Attached the fourth patch to wrap the business part inside the try ... finally. -- Added file: http://bugs.python.org/file31237/formatter_fix_resource_warning_v4.patch

[issue18644] Got ResourceWarning: unclosed file when using test function from formatter module

2013-08-12 Thread Vajrasky Kok
Vajrasky Kok added the comment: Ah, sorry about that. Attached the fifth patch to only wrap for loop section inside the try... finally. -- Added file: http://bugs.python.org/file31238/formatter_fix_resource_warning_v5.patch ___ Python tracker rep

[issue18394] cgi.FieldStorage triggers ResourceWarning sometimes

2013-08-12 Thread Vajrasky Kok
Vajrasky Kok added the comment: It happens because if the length of data is more than 1000: def __write(self, line): line is always bytes, not string if self.__file is not None: if self.__file.tell() + len(line) 1000: self.file = self.make_file

[issue18700] test_cgi raises ResourceWarning

2013-08-12 Thread Vajrasky Kok
Vajrasky Kok added the comment: Superseded by bug #18394. Should we close this one by marking it as duplicate? -- nosy: +vajrasky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18700

[issue18670] Using read_mime_types function from mimetypes module gives resource warning

2013-08-11 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the second patch to use addCleanup rather than tear down method. Also, I added the non-existent file case. -- Added file: http://bugs.python.org/file31232/fix_resource_warning_read_mime_types_v2.patch

[issue18702] Report skipped tests as skipped

2013-08-11 Thread Vajrasky Kok
Vajrasky Kok added the comment: I read the patch. It looks good. Anyway, I have two questions: 1. I saw 3 variants of writing description for skipping test descriptor: requires os.mkfifo test needs socket.inet_pton() needs os.read Which one is the preferred way to go? requires or test

[issue18678] Wrong struct members name for spwd module

2013-08-07 Thread Vajrasky Kok
New submission from Vajrasky Kok: Both python2 and python3 have this behaviour. import os; os.getuid() 0 'I am root' 'I am root' import spwd spwd.getspnam('bin') spwd.struct_spwd(sp_nam='bin', sp_pwd='*', sp_lstchg=15558, sp_min=0, sp_max=9, sp_warn=7, sp_inact=-1, sp_expire=-1

[issue18665] Typos in frame object related code

2013-08-06 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, attached the patch to fix the typo. -- keywords: +patch Added file: http://bugs.python.org/file31171/fix_typo_frame_object.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18665

[issue18670] Using read_mime_types function from mimetypes module gives resource warning

2013-08-06 Thread Vajrasky Kok
New submission from Vajrasky Kok: [sky@localhost cpython]$ cat /tmp/a.txt x-application/mimea mimea application/mimeb mimeb [sky@localhost cpython]$ cat /tmp/a.py import warnings warnings.simplefilter('default') import mimetypes mimetypes.read_mime_types('/tmp/a.txt') [sky@localhost cpython

[issue18658] Mercurial CPython log ticket link is broken

2013-08-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, it looks like it has been fixed. The format has changed as well. Previously: 5 hours ago R David Murray Merge: #18657: remove duplicate entries from Misc/ACKS.default tip 5 hours ago R David Murray #18657: remove duplicate entries from Misc/ACKS

[issue18658] Mercurial CPython log ticket link is broken

2013-08-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: Wait, something weird is happening in CPython commits log website, http://hg.python.org/cpython . These are the latest four commits. age author description 45 hours agoJason R. Coombs Issue 18532: Added tests and documentation to formally

[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok
New submission from Vajrasky Kok: There is test_precision in Lib/test_format.py which is not being unit tested. Also, there is a unused variable inside test_precision. Attached the patch to fix these problems. -- components: Tests files: test_precision.patch keywords: patch messages

[issue18661] Typo in grpmodule.c

2013-08-05 Thread Vajrasky Kok
New submission from Vajrasky Kok: I guess, there is a typo in Modules/grpmodule.c. See the patch below: diff -r f4f81ebc3de9 Modules/grpmodule.c --- a/Modules/grpmodule.c Sun Aug 04 15:50:08 2013 -0400 +++ b/Modules/grpmodule.c Mon Aug 05 17:40:33 2013 +0800 @@ -10,7 +10,7

[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: Let me help you to debug this issue. ethan@amiau:~/Documents/code/python/cpython$ cat /tmp/a.py import sys INT_MAX = sys.maxsize f = 1.2 format(f, .%sf % (INT_MAX + 1)) ethan@amiau:~/Documents/code/python/cpython$ ./python /tmp/a.py Traceback (most recent call

[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: For now, instead of hardcoding INT_MAX to 2147483647 in test, maybe we can use module: import IN IN.INT_MAX 2147483647 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18659

[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: For the passers-by who want to help: The precision too big exception is raised in Python/formatter_unicode.c line 1168 and 1002. The Too many decimal digits... exception is raised in Python/formatter_unicode.c line 71. So the question is whether

[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, I guess the fix for this ticket should be kept simple. If we want to merge the exception message or touch the code base or do something smarter than fixing the test, maybe we should create a separate ticket. So I used Serhiy Storchaka's suggestion to use

[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the third patch. The importing _testcapi part was moved inside the test. Added cpython support only decorator for this test. -- Added file: http://bugs.python.org/file31169/test_precision_v3.patch ___ Python

[issue18665] Typos in frame object related code

2013-08-05 Thread Vajrasky Kok
New submission from Vajrasky Kok: See the patch for details: diff -r 438cdc97d8ee Include/frameobject.h --- a/Include/frameobject.h Mon Aug 05 23:35:43 2013 +0200 +++ b/Include/frameobject.h Tue Aug 06 12:38:15 2013 +0800 @@ -36,7 +36,7 @@ non-generator frames. See

<    1   2   3   4   5   6   >