[issue24539] StreamReaderProtocol.eof_received() should return True to keep the transport open

2015-07-04 Thread Drekin
Drekin added the comment: I've also been hit by this issue, see https://mail.python.org/pipermail/python-list/2015-July/693496.html and the following thread. I've spent some time trying to find where the problem is, and just after I found out it's about eof_received() returning None, I could

[issue22555] Tracking issue for adjustments to binary/text boundary handling

2015-05-13 Thread Drekin
Changes by Drekin dre...@gmail.com: -- nosy: +Drekin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22555 ___ ___ Python-bugs-list mailing list

[issue17620] Python interactive console doesn't use sys.stdin for input

2015-04-28 Thread Drekin
Drekin added the comment: Note that under status quo PyOS_Readline is called from two places: the tokenizer during an interactive session and the builtin function input. The tokenizer passes promptstring encoded in sys.stdin.encoding while input() passes promtstring encoded

[issue17620] Python interactive console doesn't use sys.stdin for input

2015-01-21 Thread Drekin
Drekin added the comment: Unfortunately, I have little or no experience with Python C code and I even don't have a C compiler installed so I cannot experiment. I'll just put my ideas how to solve this here. • Add sys.__readlinehook__ attribute, which can be set to a function taking a prompt

[issue1602] windows console doesn't print or input Unicode

2015-01-15 Thread Drekin
Drekin added the comment: File redirection has nothing to do with win-unicode-console and this issue. When stdout is redirected, it is not a tty so win-unicode-console doesn't replace the stream object, which is the right thing to do. You got UnicodeEncodeError because Python creates

[issue1602] windows console doesn't print or input Unicode

2015-01-14 Thread Drekin
Drekin added the comment: Note that win-unicode-console replaces the stdio streams rather than wraps them. So the desired state would be Unicode stream objects wrapped by PTVS. There would be no problem if win-unicode-console stream replacement occured before PTVS wraps them, which should

[issue1602] windows console doesn't print or input Unicode

2015-01-03 Thread Drekin
Drekin added the comment: I tried the following code: import pdb pdb.set_trace() print(1 + 2) print(αβγ∫) When run in vanilla Python it indeed ends with UnicodeEncodeError as soon as it hits the line with non-ASCII characters. However, the solution via win_unicode_console package seems

[issue22667] Incorrect evaluation of variables with names containing supplementary characters

2014-10-22 Thread Drekin
Drekin added the comment: I understand. I have found https://mail.python.org/pipermail/python-3000/2007-May/007995.html as a reason for using NFKC rather than NFC. On the other hand I think one may want these double-struct mathematical letters to be different from the ordinary ones if used

[issue22667] Incorrect evaluation of variables with names containing supplementary characters

2014-10-18 Thread Drekin
New submission from Drekin: eval(\N{mathematical double-struck capital a}) NameError: name 'A' is not defined A = 2 eval(\N{mathematical double-struck capital a}) 2 \N{mathematical double-struck capital a} == A False -- components: Interpreter Core, Unicode messages: 229653 nosy

[issue1602] windows console doesn't print or input Unicode

2014-10-02 Thread Drekin
Drekin added the comment: stijn: You are mixing two issues here. One is reading text from a file. There is no problem with it. You just call open(path, encoding=the_encoding_of_the_file). Since the encoding of the file depends on the file, you should provide the information about it. Another

[issue22408] Tkinter doesn't handle Unicode dead key combinations on Windows

2014-09-24 Thread Drekin
Drekin added the comment: I installed wish and tried the demos shipped with Python. The behavior occurs during the demo basic editable text. So it's an issue of Tk itself. Actually the same behavior occurs even in the wish shell. -- ___ Python

[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Drekin
Drekin added the comment: Stefan Champailler: The crash you see is maybe not a crash at all. First it has nothing to do with printing, the problem is reading of your input line. That explains why Python exited even before printing the traceback of the SyntaxError. If you try to read input

[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Drekin
Drekin added the comment: Nick Coghlan: Ok, done. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602 ___ ___ Python-bugs-list mailing list

[issue1602] windows console doesn't print or input Unicode

2014-09-23 Thread Drekin
Drekin added the comment: Idle shell handles Unicode characters well, but one cannot enter them using deadkey combinations. See http://bugs.python.org/issue22408. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602

[issue22408] Tkinter doesn't handle Unicode dead key combinations on Windows

2014-09-23 Thread Drekin
Drekin added the comment: By modifier I mean a key like Shift, Ctrl, Alt, AltGr; or the corresponding modifier state. A combination modifier + base key produces either special action or a character or a dead key. A dead key affects the next character rather than producing a character itself

[issue22408] Tkinter doesn't handle Unicode key events on Windows

2014-09-15 Thread Drekin
Drekin added the comment: It seems that it's a problem of dead key combinations rather than modifiers. Unicode characters produced directly (with or without modifiers) work correctly. Only one deadkey on my keyboard doesn't work at all. AltGr + M is a deadkey, but any following key

[issue17620] Python interactive console doesn't use sys.stdin for input

2014-09-15 Thread Drekin
Drekin added the comment: I have found another problem. PyOS_Readline can be called from two different places – from Parser/tokenizer.c:tok_nextc (by REPL), which uses sys.stdin.encoding to encode prompt argument, and from Python/bltinmodule.c:builtin_input_impl (by input() function), which

[issue22408] Tkinter doesn't handle Unicode key events on Windows

2014-09-14 Thread Drekin
New submission from Drekin: Key events produced on Windows handles Unicode incorrectly when Unicode character is produced by dead-key combination. On my keyboard, (AltGr + M, a) produces several key events, last of which contains char==a, however, it should contain ∀. Also dead-key sequence

[issue17620] Python interactive console doesn't use sys.stdin for input

2014-08-30 Thread Drekin
Drekin added the comment: Antoine Pitrou: I understand. It would be nice to have that new Python string based readline hook. Its default implementation could be to call PyOS_Readline and decode the bytes using sys.stdin.encoding (as the tokenizer currently does). Tokenizer then woudn't need

[issue17620] Python interactive console doesn't use sys.stdin for input

2014-08-29 Thread Drekin
Drekin added the comment: I realized that the behavior I want can be achieved by setting PyOS_ReadlineFunctionPointer to a function calling sys.stdin.readline(). However I found another problem: Python REPL just doesn't work, when sys.stdin.encoding is UTF-16-LE. The tokenizer (Parser

[issue22257] PEP 432: Redesign the interpreter startup sequence

2014-08-28 Thread Drekin
Changes by Drekin dre...@gmail.com: -- nosy: +Drekin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22257 ___ ___ Python-bugs-list mailing list

[issue17620] Python interactive console doesn't use sys.stdin for input

2014-08-28 Thread Drekin
Drekin added the comment: I have found another example of where the current interaction between readline and Python core lead to confussion. It started with following report on my package: https://github.com/Drekin/win-unicode-console/issues/2 . Basically, IPython interactive console

[issue516762] have a way to search backwards for re

2014-08-25 Thread Drekin
Drekin added the comment: Hello, I wanted to use this feature and found this issue. It is marked as closed, being a duplicate of another closed issue. However the feature is actually not present. In 2008 it was planned to be added by Matthew Barnett in #3825, but the work of improving re

[issue1602] windows console doesn't print or input Unicode

2014-08-04 Thread Drekin
Drekin added the comment: I think that boxes are ok, it's just missing font. Without active workaroud there is just UnicodeEncodeError (with cp852 for me). There is problem with astral characters – I'm getting each box twice. It is possible that Windows console doesn't handle astral

[issue17620] Python interactive console doesn't use sys.stdin for input

2014-07-31 Thread Drekin
Drekin added the comment: I looked to the sourcecode and found the following. First, the codepath of how interactive loop gets its input follows: Python/pythonrun.c:PyRun_InteractiveLoopFlags Python/pythonrun.c:PyRun_InteractiveOneObject Python/pythonrun.c:PyParser_ASTFromFileObject Parse

[issue17620] Python interactive console doesn't use sys.stdin for input

2014-07-31 Thread Drekin
Drekin added the comment: Sorry for formating in the previous message. Repeating… I looked to the sourcecode and found the following. First, the codepath of how interactive loop gets its input follows: Python/pythonrun.c:PyRun_InteractiveLoopFlags Python/pythonrun.c:PyRun_InteractiveOneObject

[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2014-07-31 Thread Drekin
Drekin added the comment: Shouldn't there be a Ctrl-C check in Modules/_io/fileio.c:fileio_read* functions? I think some of these are called by standard sys.stdin.readline(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue17620] Python interactive console doesn't use sys.stdin for input

2014-07-30 Thread Drekin
Drekin added the comment: My naive picture of ideal situation looks like this: When the interactive loop wants input, it just calls sys.stdin.readline, which delegates to sys.stdin.buffer.raw.readinto or .read, these can use GNU readline if available to get the data. May I ask, what's wrong

[issue1602] windows console doesn't print or input Unicode

2014-07-26 Thread Drekin
Changes by Drekin dre...@gmail.com: Removed file: http://bugs.python.org/file27261/win_unicode_console_2.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602

[issue1602] windows console doesn't print or input Unicode

2014-07-26 Thread Drekin
Changes by Drekin dre...@gmail.com: Removed file: http://bugs.python.org/file29563/i.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602 ___ ___ Python

[issue1602] windows console doesn't print or input Unicode

2014-07-26 Thread Drekin
Changes by Drekin dre...@gmail.com: Removed file: http://bugs.python.org/file29564/win_unicode_console_3.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602

[issue1602] windows console doesn't print or input Unicode

2014-07-26 Thread Drekin
Changes by Drekin dre...@gmail.com: Removed file: http://bugs.python.org/file31756/streams.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602

[issue1602] windows console doesn't print or input Unicode

2014-07-26 Thread Drekin
Changes by Drekin dre...@gmail.com: Removed file: http://bugs.python.org/file31770/win_unicode_console.zip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602

[issue1602] windows console doesn't print or input Unicode

2014-07-26 Thread Drekin
Changes by Drekin dre...@gmail.com: Removed file: http://bugs.python.org/file35990/win_unicode_console.zip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602

[issue1602] windows console doesn't print or input Unicode

2014-07-26 Thread Drekin
Drekin added the comment: I have deleted all my old files and added only my current implementation of the stream objects as the only relevant part to this issue. @Mark Summerfield: I have added __init__.py to the new version of win_unicode_console. If there is any problem, you can start

[issue1602] windows console doesn't print or input Unicode

2014-07-20 Thread Drekin
Changes by Drekin dre...@gmail.com: Removed file: http://bugs.python.org/file27245/win_unicode_console.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602

[issue1602] windows console doesn't print or input Unicode

2014-07-20 Thread Drekin
Drekin added the comment: @Victor Stinner: You are right. So I did it. Here are the links to GitHub and PyPI: https://github.com/Drekin/win-unicode-console, https://pypi.python.org/pypi/win_unicode_console. I also tried to delete the files, but it seems that it is only possible to unlink

[issue1602] windows console doesn't print or input Unicode

2014-07-18 Thread Drekin
Drekin added the comment: I have made some updates in the streams code. Better error handling (getting errno by GetLastError() and raising exception when zero bytes are written on non-zero input). This prevents the infinite loop in BufferedIOWriter.flush() when there is odd number of bytes

[issue17620] Python interactive console doesn't use sys.stdin for input

2014-07-18 Thread Drekin
Drekin added the comment: There is still the serious inconsistency that the `sys.stdin` is not used for input by interactive loop but its encoding is. So if I replace `sys.stdin` with a custom object with its own `encoding` attribute, the standard interactive loop tries to use this encoding

[issue19040] Problems with overriding Enum.__new__

2013-09-23 Thread Drekin
Drekin added the comment: Yes, I've done it similarily using a class method. Thank you for help. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19040

[issue10042] functools.total_ordering fails to handle NotImplemented correctly

2013-09-19 Thread Drekin
Drekin added the comment: Hello, I have run into this when I wanted to use OrderedEnum and the example in enum docs seemed too repetitive to me. It's nice to know that it's being worked on. -- nosy: +Drekin ___ Python tracker rep...@bugs.python.org

[issue19040] Problems with overriding Enum.__new__

2013-09-17 Thread Drekin
New submission from Drekin: I tried to implement an Enum variant OptionalEnum such that OptionalEnum(value) leaves value alone and returnes it (if there is no corresponding enum member) rather than raising ValueError. My use case is following: I'm trying to parse some keyboard layout related

[issue1602] windows console doesn't print or input Unicode

2013-09-15 Thread Drekin
Drekin added the comment: Glenn Linderman: Yes I have built on what the others learned. For your question, I made it and tested it in Python 3.3, it should also work in 3.4 and what I've tried, it actually works. As Terry J. Reedy says you can just load the module and enable the streams. I do

[issue1602] windows console doesn't print or input Unicode

2013-09-14 Thread Drekin
Drekin added the comment: Hello again. I have rewritten the custom stdio objects and implemented them as raw io reading and writing bytes in UTF-16-LE encoding. They are then wrapped in standard BufferedReader/Writer and TextIOWrapper objects. This approach also solves a bug of wrong string

[issue13758] compile() should not encode 'filename' (at least on Windows)

2013-09-14 Thread Drekin
Drekin added the comment: Since this issue was fixed, shouldn't it be marked fixed here? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13758

[issue18838] The order of interactive prompt and traceback on Windows

2013-08-26 Thread Drekin
New submission from Drekin: On Windows, Python 3.3.2, when I run Python as a subprocess via Popen(py -i somescript.py, stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate() and somescript.py ends with exception, there is first interactive promt in stderr output and then the traceback which

[issue12869] PyOS_StdioReadline is printing the prompt on stderr

2013-08-25 Thread Drekin
Drekin added the comment: Related stackoverflow question: http://stackoverflow.com/questions/18419787/where-does-pythons-interactive-prompt-output-to . -- nosy: +Drekin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12869

[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2013-08-25 Thread Drekin
Drekin added the comment: Why are there actually more codepaths which may raise this issue? My naive idea would be that input() is just thin wrapper around sys.stdout.write() (for prompt) and sys.stdin.readline() which leads to sys.stdin.buffer.raw.read* where is the place where some low

[issue17588] runpy cannot run Unicode path on Windows

2013-08-23 Thread Drekin
Drekin added the comment: There is over year old closely related issue: http://bugs.python.org/issue13758 . -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17588

[issue13758] compile() should not encode 'filename' (at least on Windows)

2013-08-23 Thread Drekin
Drekin added the comment: Hello. Will this be fixed? It's really annoying that you cannot pass valid unicode filename to compile(). I'm using a workaround: I just pass placeholder and then “update” the resulting code object recursively to set the correct co_filename. Afterwards the code

[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-08-23 Thread Drekin
Drekin added the comment: This patch introduces a bit ugly traceback. Shouldn't there be “raise from None” or “raise from previous_exc” instead of simple raise? -- nosy: +Drekin ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue17702] os.environ converts key type from string to bytes in KeyError exception

2013-08-23 Thread Drekin
Drekin added the comment: It's also in __delitem__. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17702 ___ ___ Python-bugs-list mailing list

[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2013-07-30 Thread Drekin
New submission from Drekin: When I run sys.stdin.readline() interactivelly (on Windows and Python 3.3.2) and hit Ctrl-C, sometimes it returns an empty string just before KeyboardInterrupt is raised. Sometimes it isn't even raised and instead after hitting Return some weird SyntaxtError

[issue18597] On Windows sys.stdin.readline() doesn't handle Ctrl-C properly

2013-07-30 Thread Drekin
Drekin added the comment: I haven't experience with Python C code but I tried to find some clues in the code. First for input(): it call PyOS_Readline which may call PyOS_StdioReadline my_fgets fgets in Parser/myreadline.c. There is Windows related comment on line 56: “Ctrl-C anywhere

[issue17620] Python interactive console doesn't use sys.stdin for input

2013-07-28 Thread Drekin
Drekin added the comment: Is there any chance the API will be added and used by python.exe? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17620

[issue11619] On Windows, don't encode filenames in the import machinery

2013-07-28 Thread Drekin
Drekin added the comment: Is there a chance this will be fixed at least in Python 4? -- nosy: +Drekin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11619

[issue18331] runpy.run_path gives functions with corrupted .__globals__

2013-06-30 Thread Drekin
New submission from Drekin: Let's have a simple script test.py: def f(): return x x = 2 print(f()) Now if we try to run it via runpy.run_path, we get the following: import runpy g = runpy.run_path(test.py) 2 g[f]() is None True g[x] is 2 True g[f].__globals__[x] is None True

[issue17730] code.interact() doesn't support no banner

2013-04-14 Thread Drekin
New submission from Drekin: Currently, there is no way to run code.interact without a banner – empty string still means to print an empty line. If I want that behaviour, I must subclass code.InteractiveConsole and reimplement whole .interact method including the repl logic just not to print

[issue17620] Python interactive console doesn't use sys.stdin for input

2013-04-11 Thread Drekin
Drekin added the comment: I encountered it when I changed sys.stdin at runtime (I thought it was a supported feature) to affect the interactive console, see http://bugs.python.org/issue1602 . -- versions: -Python 2.7 ___ Python tracker rep

[issue17620] Python interactive console doesn't use sys.stdin for input

2013-04-06 Thread Drekin
Drekin added the comment: Sorry for typos. • interactive console doesn't use sys.stdin for input, why? • it uses sys.stdin.encoding, shouldn't it rather use sys.__stdin__.encoding if anything? • input() and hence code.interact() uses sys.stdin

[issue17619] MS WINDOWS: input() swallows KeyboardInterrupt in Python 3.3

2013-04-03 Thread Drekin
Drekin added the comment: I have Windows Vista Business SP2, 64-bit, (6.0.6002). If I start Python any way (from console, from shortcut, via py.exe or not) the same behavior occurs. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue17619] MS WINDOWS: input() swallows KeyboardInterrupt in Python 3.3

2013-04-03 Thread Drekin
Drekin added the comment: However it raises the exception correctly in IDLE. The same behavior occured on Windows 7 Home Premium SP1, 64-bit, (6.1.7601). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17619

[issue17588] runpy cannot run Unicode path on Windows

2013-04-03 Thread Drekin
Drekin added the comment: I have no specific use case. I just thought that runpy.run_path should work similarily as if the file was run directly (which works). File ∫.py can be created, displayed and run by Python with no problem in Windows

[issue17619] MS WINDOWS: input() swallows KeyboardInterrupt in Python 3.3

2013-04-03 Thread Drekin
Drekin added the comment: There is related weird behavior: try: ... input() ... except KeyboardInterrupt: ... print(exception occured) ... # Ctrl-C hit Traceback (most recent call last): File stdin, line 2, in module KeyboardInterrupt During handling of the above exception, another

[issue17619] input() swallows KeyboardInterrupt in Python 3.3

2013-04-02 Thread Drekin
New submission from Drekin: At least on Windows, input() doesn't raise KeyboardInterrupt when Ctrl-C is hit in Python 3.3 (it does in Python 3.2). 3.3: x = input() # Ctrl-C hit - no exception raised x NameError 3.2: x = input() # Ctrl-C hit KeyboardInterrupt -- messages: 185845

[issue17620] Python interactive console doesn't use sys.stdin for input

2013-04-02 Thread Drekin
New submission from Drekin: The Python interactive console actually doesn't use sys.stdin but standard C stdin for input. Is there any reason for this? Why it then uses its encoding attribute? (Assigning sys.stdin something, that doesn't have encoding attribute freezes the interpreter

[issue17588] runpy cannot run Unicode path on Windows

2013-03-31 Thread Drekin
New submission from Drekin: runpy.run_path(\u222b.py) raises UnicodeEncodeError when trying to use mbcs codec on Windows. However opening the file using open() is ok. So why is runpy trying to encode the name using mbcs encoding when it's not necessary or even correct? See http://bpaste.net

[issue1602] windows console doesn't print or input Unicode

2013-03-24 Thread Drekin
Drekin added the comment: Hello. I have made a small upgrade of the workaround. • win_unicode_console.enable_streams() sets sys.stdin, stdout and stderr to custom filelike objects which use Windows functions ReadConcoleW and WriteConsoleW to handle unicode data properly. This can be done

[issue1602] windows console doesn't print or input Unicode

2013-03-24 Thread Drekin
Changes by Drekin dre...@gmail.com: Added file: http://bugs.python.org/file29564/win_unicode_console_3.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1602

[issue1602] windows console doesn't print or input Unicode

2012-09-22 Thread Drekin
Drekin added the comment: I have finished a solution working for me. It bypasses standard Python interactive interpreter and uses its own repl based on code.interact(). This repl is activated by an ugly hack since PYTHONSTARTUP doesn't apply when some file is run (python -i somefile.py). Why

[issue1602] windows console doesn't print or input Unicode

2012-09-21 Thread Drekin
Drekin added the comment: Hello, I'm trying to handle Unicode input and output in Windows console and found this issue. Will this be solved in 3.3 final? I tried to write a solution (file attached) based on solution here – rewriting sys.stdin and sys.stdout so it uses ReadConsoleW