That's what we used to do with the std::stream implementation, that
avoids eavy string parsin, but it 's not enough, you have to keep the
string :

>>> open("/tmp/test", "wrawar+b").mode
'wrawar+b'

I'll switch back to that behaviour.
On 02/03/2013 01:36, joker-eph wrote:
> In pythran/pythonic++/core/file.h:
> 
>> +
>> +			struct _file{
>> +					FILE* f;
>> +					_file() : f(nullptr) {}
>> +					_file(core::string const& filename, core::string const& strmode = "r") : f(fopen(filename.c_str(), strmode.c_str())){}
>> +					FILE* operator*() const {return f;}
>> +					~_file() {if(f) fclose(f);}
>> +			};
>> +
>> +			class file {
>> +
>> +                typedef _file container_type;
>> +                impl::shared_ref<container_type> data; 
>> +					private:
>> +				bool is_open;
>> +				core::string mode, name, newlines;
> 
> Do you have a ref for your claim about python? From 2.7 sources I have:
> 
> |typedef struct {
>     PyObject_HEAD
>     int fd;
>     unsigned int readable : 1;
>     unsigned int writable : 1;
>     signed int seekable : 2; /* -1 means unknown */
>     unsigned int closefd : 1;
>     PyObject *weakreflist;
>     PyObject *dict;
> } fileio;
> |
> 
> I still beleave that an enum or a bit set is the way to go. For Serge :
> PIPS' souvenirs :)
> 
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/serge-sans-paille/pythran/pull/53/files#r3213489>.
>