This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 3.8.3 (default, May 14 2020, 11:03:12) | |
[GCC 9.3.0] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> class A: | |
... def __init__(self): | |
... print("A.__init__") | |
... raise Exception() | |
... def __del__(self): | |
... print("A.__del__") | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcc capi.h | |
capi.h:6:4: warning: '/*' within block comment [-Wcomment] | |
* /** | |
^ | |
capi.h:9:3: error: expected identifier or '(' | |
*/ | |
^ | |
capi.h:12:19: error: unknown type name 'Foo' | |
void a_func(const Foo *foo); | |
^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
/* | |
* /** | |
This is a doc | |
*/ | |
*/ | |
typedef struct Foo Foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
This is a doc | |
*/ | |
pub enum Foo { | |
Bar, | |
} | |
#[no_mangle] | |
pub unsafe extern "C" fn a_func(foo: *const Foo) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/magic.py b/magic.py | |
index cd5ff24..10685ac 100644 | |
--- a/magic.py | |
+++ b/magic.py | |
@@ -193,14 +193,15 @@ def coerce_filename(filename): | |
return None | |
# ctypes will implicitly convert unicode strings to bytes with | |
- # .encode('ascii'). A more useful default here is | |
- # getfilesystemencoding(). We need to leave byte-str unchanged. |