[issue35366] Monkey Patching class derived from ctypes.Union doesn't work
New submission from Vijay : I am trying to "monkey patch" a class derived from Python ctypes "Union", but I am unable to do so - getting weird errors and sometimes seg-faults. The same thing works quite well when deriving from ctypes "Structure". I have narrowed this to down to the simplest possible test case which I am posting below. I am using Python 3.6.4. I am wondering if I am doing something wrong (or is there a problem with the ctypes "Union" implementation?). The example python code is attached with this issue. Please see the output below (for the attached code in Python 3.6.4). Using Structure: Print Type #1: [ 10, 20 ] Original : Patched : Patched (dict) : Print Type #2: ( 10, 20 ) Using Union: Print Type #1: [ 20, 20 ] Original : Patched : Patched (dict) : Traceback (most recent call last): File "ctypes_bug.py", line 54, in print(a) TypeError: 'managedbuffer' object is not callable Clearly, I am able to "patch" __str__ when the corresponding Python object was derived from "Structure", but I am unable to "patch" __str__ when the corresponding Python object was derived from "Union". Interestingly, MyUnion.__dict__[__str__] and MyUnion.__str__ shows different results - which is weird as well. Is there something I am doing wrong here, or is there an issue with ctypes.Union? I highly appreciate any help or insight! -- components: ctypes files: ctypes_bug.py messages: 330817 nosy: rvijayc priority: normal severity: normal status: open title: Monkey Patching class derived from ctypes.Union doesn't work type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47961/ctypes_bug.py ___ Python tracker <https://bugs.python.org/issue35366> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35366] Monkey Patching class derived from ctypes.Union doesn't work
Vijay added the comment: Wanted to post a possible workaround until this is fixed. One can simply wrap a union anonymously inside a structure. Like so: struct my_struct_s { union my_union_u { }; }; This temporarily solved the problem in my case. -- ___ Python tracker <https://bugs.python.org/issue35366> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34553] Python Crashes when trying to access any date related fields in MailItem
New submission from Vijay : MailItem.SentOn or MailItem.ReceivedTime, Python crashes with windows showing "Python has stopped working" dialog window. What can be the cause of this issue? import win32com.client import os import datetime from datetime import timedelta outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") inbox = outlook.GetDefaultFolder(6) messages=inbox.Items message = messages.GetLast() print(type(message)) t = message.ReceivedTime crashes when the script is reached this line. Attached the screenshot for your reference. -- files: python crash.PNG messages: 324406 nosy: vijay priority: normal severity: normal status: open title: Python Crashes when trying to access any date related fields in MailItem type: crash versions: Python 3.7 Added file: https://bugs.python.org/file47774/python crash.PNG ___ Python tracker <https://bugs.python.org/issue34553> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34553] Python Crashes when trying to access any date related fields in MailItem
Vijay added the comment: i have already added the script. try to run in the python3.7. python is getting crashed. -- ___ Python tracker <https://bugs.python.org/issue34553> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34553] Python Crashes when trying to access any date related fields in MailItem
Vijay added the comment: Thanks for the inputs. i will check with pywin32 team. is there any pywin32 link to raise the case. please share if you know. -- ___ Python tracker <https://bugs.python.org/issue34553> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34553] Python Crashes when trying to access any date related fields in MailItem
Vijay added the comment: can someone please clarify, is it a pywin32 issue or python3.7 issue?. -- ___ Python tracker <https://bugs.python.org/issue34553> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5712] tkinter - askopenfilenames returns string instead of tuple in windows 2.6.1 release
vijay added the comment: Two issues related with the workaround suggested by nosklo. 1. Splitting the filepaths isnt simple, as there may be blank spaces etc. 2. We have different versions of Python installed in our Lab machines, some have 2.5 and others got 2.6. If I run the code using the version2.6 workaround on a machine with version2.5, obviously it gives an error!! Any updates on a fix? This bug is really giving me a hard time. -- nosy: +luckycusp ___ Python tracker <http://bugs.python.org/issue5712> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5712] tkinter - askopenfilenames returns string instead of tuple in windows 2.6.1 release
vijay added the comment: Update!! I found a very good workaround for this and it works very nicely, with both 2.5 and 2.6 versions. Below is the segment from my code:- from Tkinter import * import tkFileDialog master = Tk() master.withdraw() #hiding tkinter window Inputfiles = tkFileDialog.askopenfilenames(title="Select the source input file(s)", filetypes=[("mpf file",".mpf"),("All files",".*")]) #Heres the TRICK! InputfilesList = master.tk.splitlist(Inputfiles) -- ___ Python tracker <http://bugs.python.org/issue5712> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5712] tkinter - askopenfilenames returns string instead of tuple in windows 2.6.1 release
vijay added the comment: Hi Clovis Ok, I did not check if your split string function check for spaces or not, sorry for that. In my first post I mentioned this:- "2. We have different versions of Python installed in our Lab machines, some have 2.5 and others got 2.6. If I run the code using the version2.6 workaround on a machine with version2.5, obviously it gives an error!!" Infact I started out using your split string function but it was on a machine with Python2.6. It worked fine. Then I ran the same code on a machine with version Python2.5 and it threw an error when I tried calling your function, because the argument I passed to your function was already a tuple and not a string!! (I hope I could explain without confusing) I would prefer my code to have some level of downward compatibility (to be able to run on Python of lower versions). Thats the reason I prefer to use the 'splitlist' method from Tkinter, as I dont need to change my code for different Python versions. Best Regards Vijay -- ___ Python tracker <http://bugs.python.org/issue5712> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14322] More test coverage for hmac
Changes by Vijay Majagaonkar : -- nosy: +Vijay.Majagaonkar ___ Python tracker <http://bugs.python.org/issue14322> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26543] [EASY] imaplib noop Debug: bytes vs Unicode bug in debug mode
Change by Govind Vijay : -- versions: -Python 3.6 ___ Python tracker <https://bugs.python.org/issue26543> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16512] imghdr doesn't recognize variant jpeg formats
Change by Govind Vijay : -- pull_requests: +7860 stage: test needed -> patch review ___ Python tracker <https://bugs.python.org/issue16512> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20922] Global variables
New submission from VIJAY KANSAL: Inside functions: 1. Python allows access to global variables. 2. Python allows creation of local variable with the same name as that of of some of the global variable. Keeping the above two statements in mind, I believe that Python must allow following sequential statements in a function: 1. Accessing global variable 2. Creating local variable with the same name as that of some of the global variable name. But, it seems that the above is not allowed. The below code has the following output: Printing: 12 Throwing Error: Traceback (most recent call last): File "./bug.py", line 14, in func2() File "./bug.py", line 9, in func2 print 'Throwing Error: ', var UnboundLocalError: local variable 'var' referenced before assignment CODE: var = 12 def func1(): print 'Printing: ', var def func2(): print 'Throwing Error: ', var var = 10 print 'Unreachable Code: ', var func1() func2() -- messages: 213520 nosy: vijay_kansal priority: normal severity: normal status: open title: Global variables type: behavior versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue20922> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20922] Global variables and Local Variables with same name
Changes by VIJAY KANSAL : -- title: Global variables -> Global variables and Local Variables with same name ___ Python tracker <http://bugs.python.org/issue20922> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com