@@ -779,6 +779,24 @@ tok_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct t
779
779
if (c == '.' ) {
780
780
c = tok_nextc (tok );
781
781
hexfraction :
782
+ /* Allow attribute access on hexadecimal integer literals for
783
+ * for existing public attributes on int's, e.g. 0x1.bit_length(). */
784
+ if ((c == 'a' && lookahead (tok , "s_integer_ratio" )) ||
785
+ (c == 't' && lookahead (tok , "o_bytes" )) ||
786
+ (c == 'b' && (lookahead (tok , "it_count" ) ||
787
+ lookahead (tok , "it_length" ))) ||
788
+ (c == 'c' && lookahead (tok , "onjugate" )) ||
789
+ (c == 'd' && lookahead (tok , "enominator" )) ||
790
+ (c == 'f' && lookahead (tok , "rom_bytes" )) ||
791
+ (c == 'i' && (lookahead (tok , "mag" ) ||
792
+ lookahead (tok , "s_integer" ))) ||
793
+ (c == 'n' && lookahead (tok , "umerator" )) ||
794
+ (c == 'r' && lookahead (tok , "eal" )))
795
+ {
796
+ tok_backup (tok , c );
797
+ c = '.' ;
798
+ goto hexint ;
799
+ }
782
800
if (Py_ISXDIGIT (c )) {
783
801
c = tok_digits_tail (tok , 16 );
784
802
if (c == 0 ) {
@@ -791,6 +809,7 @@ tok_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct t
791
809
if (c == 'p' || c == 'P' ) {
792
810
goto exponent ;
793
811
}
812
+ hexint :
794
813
if (!verify_end_of_number (tok , c , "hexadecimal" )) {
795
814
return MAKE_TOKEN (ERRORTOKEN );
796
815
}
0 commit comments