Re: Custom type: PyObject_IS_GC access violation
Bue Krogh Vedel-Larsen wrote: But if I call SA_PyVector_Type.tp_new = PyType_GenericNew; PyType_Ready( SA_PyVector_Type ); then, when Py_Finalize is called, PyObject_IS_GC(op) in visit_decref() in gcmodule.c causes an access violation. If I don't call PyType_Ready, then the access violation doesn't occure, but then the type can't be used... So, the question is, does anyone have any idea about what could be causing this? Most likely some code that you haven't shown. Here is the expansion of PyObject_IS_GC(op) #define PyObject_IS_GC(o) (PyType_IS_GC((o)-ob_type) \ ((o)-ob_type-tp_is_gc == NULL || (o)-ob_type-tp_is_gc(o))) so it becomes PyType_IS_GC(op-type) (op-ob_type-tp_is_gc==NULL || op-ob_type-tp_is_gc(op)) Then, PyType_IS_GC(op-type) becomes PyType_HasFeature((op-type), Py_TPFLAGS_HAVE_GC) which in turn becomes (op-tp_flags Py_TPFLAGS_HAVE_GC) != 0 So typically, PyObject_IS_GC goes to the type of the object, which should never crash, and then looks into the flags of the type, which cannot crash - unless somebody messed with ob_type of the object, and unless this isn't a Python object in the first place. You did not say what kind of object op was in the crash - this is something you should investigate further. Does it point to a Python object? If so, what is the type of the Python object? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: How to use 8bit character sets?
copx wrote: For some reason Python (on Windows) doesn't use the system's default character set and that's a serious problem for me. I very much doubt this statement: Python does use the system's default character set on Windows. What makes you think it doesn't? Is it possible to tell Python to use an 8bit charset (latin-1 in my case) for textfile and string processing by default? That is the default. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: identifying 64-bit Windows from 2.3.5?
Steven Knight wrote: Can some Windows-savvy Pythonista point me to some way to distinguish between these two? I would look at the environment variable PROCESSOR_ARCHITECTURE. On the Win64 machine I use, its value is IA64. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: What is different with Python ?
Philippe C. Martin wrote: I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very pragmatic - 3) I usually move forward when I get the gut feeling I am correct - 4) Most likely because of 1), I usually do not manage to fully explain 3) when it comes true. - 5) I have developed for many years (18) in many different environments, languages, and O/S's (including realtime kernels) . Yet for the first time I get (most) of my questions answered by a language I did not know 1 year ago. As I do try to understand concepts when I'm able to, I wish to try and find out why Python seems different. Unfortunately, you didn't give many examples of what you did for the last 18 years (except that that also included RT kernels). So let me guess two aspects: 1. In these 18 years, you got acquainted to a variety of concepts in various languages. When dealing with Python, you could easily correlate between Python concepts and the ones you are familiar with. This is one of Python's strenghts: it tries not to be surprising, but builds on what most people consider standard. Try import this some time; you may be experiencing the Zen: Readability counts. ... Special cases aren't special enough to break the rules. Although practicality beats purity. ... In the face of ambiguity, refuse the temptation to guess. 2. You may not have dealt with a weakly-typed language before. If that is the case, your feeling of something being different most likely comes from that difference. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: thread vs GC
Paul Rubin wrote: Any suggestions for the cleanest way to get rid of the thread? As Jeff explains, it is rather unlikely that GC will collect primegen objects, since the generating thread holds self as a local variable. You should make background_generator have explicit q and event arguments, and you should signal the event in __del__. However, this won't terminate the thread, since it still hangs in .put. So it might be easiest to .read() in __del__ first. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.5 CVS broken for HP-UX platform?
mg wrote: While trying to compile Python 2.5 from the nighlty CVS image, it raises the following errors on HP-UX. This disables me the use of HP-UX for some projects: Please submit patches to sf.net/projects/python. Thanks, Martin -- http://mail.python.org/mailman/listinfo/python-list