Ticket #553 (closed defect: fixed)
Make inferring Python str type unsafe
| Reported by: | craigcitro | Owned by: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | 0.13 |
| Component: | Code Generation | Keywords: | |
| Cc: |
Description
Currently, the type inferencer is happy to infer any Python type. However, in the case that it infers that something is of type str, it will no longer allow automatic coercion between that object and a char *. While one could argue that this is morally a good idea, it's going to break huge amounts of existing user code (for instance in Sage).
An easy fix is to simply make the inference of str unsafe. This means that it's off by default, so users won't hit it by accident. Of course, this is frustrating in the case that a user does want to try out "unsafe" type inference, or if we want to start inferring str for other reasons. There are at least three obvious things we can do to fix this in the long term:
- Revisit the issue of str <--> char * coercion, at least for Py2 only
- Separate the "infer str type" decision from other type inference, via any of the usual mechanisms
- Make people change their existing code.
