File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed 
Lib/test/test_tools/i18n_data Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -101,3 +101,10 @@ msgstr ""
101101msgid  "thud" 
102102msgstr  "" 
103103
104+ #.  i18n: This is a translator comment
105+ #.  i18n: This is another translator comment
106+ #.  i18n: This is yet another translator comment
107+ #:  comments.py:78 
108+ msgid  "foos" 
109+ msgstr  "" 
110+ 
Original file line number Diff line number Diff line change 7070# i18n: This is a translator comment 
7171_ ('xyzzy' )
7272_ ('thud' )
73+ 
74+ 
75+ ## i18n: This is a translator comment 
76+ # # i18n: This is another translator comment 
77+ ### ###    i18n: This is yet another translator comment 
78+ _ ('foos' )
Original file line number Diff line number Diff line change 144144import  importlib .machinery 
145145import  importlib .util 
146146import  os 
147+ import  re 
147148import  sys 
148149import  time 
149150import  tokenize 
@@ -329,7 +330,9 @@ def get_source_comments(source):
329330    comments  =  {}
330331    for  token  in  tokenize .tokenize (BytesIO (source ).readline ):
331332        if  token .type  ==  tokenize .COMMENT :
332-             comments [token .start [0 ]] =  token .string .removeprefix ('#' ).strip ()
333+             # Remove any leading combination of '#' and whitespace 
334+             comment  =  re .sub (r'^[#\s]+' , '' , token .string )
335+             comments [token .start [0 ]] =  comment 
333336    return  comments 
334337
335338
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments