[issue18503] No assertion in test_del_param_on_nonexistent_header function and unused variables in some places in test_email.py

2013-07-19 Thread Vajrasky Kok
Vajrasky Kok added the comment: Okay, next time I'll separate the problems into different tickets. Here is the patch to clean up the test. -- Added file: http://bugs.python.org/file30988/small_clean_up_to_test_email.txt ___ Python tracker rep

[issue18516] Typos in Lib/email/generator.py and Lib/email/architecture.rst

2013-07-20 Thread Vajrasky Kok
New submission from Vajrasky Kok: [sky@localhost cpython]$ grep -n boudary Lib/email/generator.py 352:# _make_boudary = Generator._make_boundary [sky@localhost cpython]$ grep -n fuzy Lib/email/architecture.rst 27:This division is intentionally a bit fuzy; the API described

[issue18516] Typos in Lib/email/generator.py and Lib/email/architecture.rst

2013-07-21 Thread Vajrasky Kok
Vajrasky Kok added the comment: Sorry, my bad. The tuple pluralization is correct. I read it wrongly. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18516

[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread Vajrasky Kok
Vajrasky Kok added the comment: Here is the patch for this ticket. David Murray, am I on the right path? If yes, I'll put more robust tests, such as the ones with Asian encodings and unusual encodings. -- Added file: http://bugs.python.org/file30997/set_payload_binary.txt

[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread Vajrasky Kok
Changes by Vajrasky Kok sky@speaklikeaking.com: Removed file: http://bugs.python.org/file30997/set_payload_binary.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18324

[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread Vajrasky Kok
Vajrasky Kok added the comment: Sorry, got typo for the last patch. -- Added file: http://bugs.python.org/file30998/set_payload_binary.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18324

[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread Vajrasky Kok
Vajrasky Kok added the comment: It looks like you are still patching get_payload. This should be a really simple patch against set_payload. Okay, do I get it right at this time? About your second point, I need more time to think about it. -- Added file: http://bugs.python.org

[issue18563] No unit test for yiq to rgb and rgb to yiq converting functions

2013-07-26 Thread Vajrasky Kok
New submission from Vajrasky Kok: Module colorsys has hsv_to_rgb, rgb_to_hsv, hls_to_rgb, rgb_to_hls, yiq_to_rgb, rgb_to_yig public API functions. But only hsv_to_rgb, rgb_to_hsv, hls_to_rgb, rgb_to_hls functions are being unit tested. Attached the patch for adding unit test to cover

[issue18324] set_payload does not handle binary payloads correctly

2013-07-26 Thread Vajrasky Kok
Vajrasky Kok added the comment: Here is the third version of the patch. I am not sure what to do with the invalid data for base64 and uuencode. I decided to raise exception instead of converting it to None silently. -- Added file: http://bugs.python.org/file31049/set_payload_binary_v3

[issue18581] Duplicate test and missing class test in test_abc.py

2013-07-28 Thread Vajrasky Kok
New submission from Vajrasky Kok: There are two classes in Lib/test/test_abc.py, which are TestABC and TestLegacyAPI. Only TestABC is being unit tested. Beside that TestLegacyAPI class has one duplicate test, which is test_abstractmethod_integration with TestABC class. -- components

[issue18585] Add a text truncation function

2013-07-29 Thread Vajrasky Kok
Vajrasky Kok added the comment: Something is not right if we use more than one space. textwrap.summarize('hello world!', width=12) 'hello world!' textwrap.summarize('hello world!', width=11) 'hello (...)' textwrap.summarize('hello world!', width=10) '(...)' I expect the last

[issue18585] Add a text truncation function

2013-07-29 Thread Vajrasky Kok
Vajrasky Kok added the comment: Beside of that, I notice the new lines are deleted silently. textwrap.summarize('republicans are red,\ndemocrats are blue,\nneither one of them,\ncares about you.', width=46) 'republicans are red, democrats are blue

[issue18593] Typo in Lib/multiprocessing/heap.py

2013-07-29 Thread Vajrasky Kok
New submission from Vajrasky Kok: $ grep Inheirtable Lib/multiprocessing/* Lib/multiprocessing/heap.py:# Inheirtable class which wraps an mmap, and from which blocks can be allocated -- assignee: docs@python components: Documentation messages: 193913 nosy: docs@python, vajrasky

[issue18585] Add a text truncation function

2013-07-31 Thread Vajrasky Kok
Vajrasky Kok added the comment: Monsieur Pitrou, thanks for the explanation. Actually, IMHO I prefer, 'hello (...)' should be the minimum words we can use not '(...)' because '(...)' does not make any sense. But, anyway, it's your call. :) Anyway, using your summarize2.patch

[issue1666318] shutil.copytree doesn't give control over directory permissions

2013-07-31 Thread Vajrasky Kok
Vajrasky Kok added the comment: Hi Catherine, I saw your patch. It looks good, except you are trying to copy the directory onto its subdirectory. src_dir = tempfile.mkdtemp() dst_dir = os.path.join(tempfile.mkdtemp(), 'destination') I prefer it if you copy it to somewhere else. This would

[issue18627] Typo in Modules/hashlib.h

2013-08-01 Thread Vajrasky Kok
New submission from Vajrasky Kok: Got typo in Modules/hashlib.h. See this patch for detail: --- a/Modules/hashlib.h Wed Jul 31 20:48:26 2013 -0400 +++ b/Modules/hashlib.h Fri Aug 02 12:39:00 2013 +0800 @@ -2,7 +2,7 @@ /* * Given a PyObject* obj, fill in the Py_buffer* viewp with the result

[issue18606] Add statistics module to standard library

2013-08-03 Thread Vajrasky Kok
Vajrasky Kok added the comment: Is there a reason why there is no 'review' link? Could it be because the file is uploaded as is rather than as a patch? I think I can answer this question. The answer is yes. You can have review only if you use diff not raw file. The original poster, Steven

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

2013-08-03 Thread Vajrasky Kok
New submission from Vajrasky Kok: This python is compiled with --with-pydebug option. [sky@localhost cpython]$ cat /tmp/a.txt manly man likes cute cat. [sky@localhost cpython]$ ./python Python 3.4.0a0 (default:e408e821d6c8, Jul 27 2013, 10:49:54) [GCC 4.7.2 20121109 (Red Hat 4.7.2-8)] on linux

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

2013-08-03 Thread Vajrasky Kok
Vajrasky Kok added the comment: Sorry, I forgot about stdin. Attached the patch to handle stdin gracefully. -- Added file: http://bugs.python.org/file31139/formatter_fix_resource_warning_v2.patch ___ Python tracker rep...@bugs.python.org http

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

2013-08-03 Thread Vajrasky Kok
Vajrasky Kok added the comment: I guess I should not close stdin just in case people are using test function in the script. Attached the patch to only close the open files not stdin. -- Added file: http://bugs.python.org/file31140/formatter_fix_resource_warning_v3.patch

[issue18658] Mercurial CPython log ticket link is broken

2013-08-04 Thread Vajrasky Kok
New submission from Vajrasky Kok: Go to http://hg.python.org/cpython. All ticket links (number preceded by #), such as #18567 refer to bugs in jython. For example: 5 hours ago R David Murray Merge: #18657: remove duplicate entries from Misc/ACKS.default tip 5 hours ago R David Murray

[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

[issue18666] Unused variable in test_frame.py

2013-08-05 Thread Vajrasky Kok
New submission from Vajrasky Kok: There is a unused variable in Lib/test/test_frame.py. def test_clear_executing_generator(self): # Attempting to clear an executing generator frame is forbidden. endly = False def g(): nonlocal endly try

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

[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

  1   2   3   4   5   6   >