Stalker created this task.
Stalker added a project: Pywikibot.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.

TASK DESCRIPTION
  Steps to Reproduce: 
  Python3, pywikibot==4.1.1, osmium==3.0.1
  Download some .pbf file (openstreetmap binary format that should be parsed 
with osmium library). Liechtenstein is small (2.3MB) - 
http://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf. Run following 
minimal example:
  
    import osmium, pywikibot
    en_wiki = pywikibot.Site("en", "wikipedia")
    
    class TestHandler(osmium.SimpleHandler):
        def node(self, n):
            print(n.id)
            entry = pywikibot.Page(en_wiki, 'non-existing article or even 
redirect')
            entry.text
            entry.clear_cache()  # Clear cache even works if there is no call 
to `.text`
    
    h = TestHandler()
    # Download from 
http://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf
    h.apply_file('liechtenstein-latest.osm.pbf')
  
  Actual Results:
  
  Script fails with bug mentioned even in osmium docs 
<https://docs.osmcode.org/pyosmium/latest/intro.html#collecting-data-from-an-osm-file>:
  
    Traceback (most recent call last):
      File "main.py", line 15, in <module>
        h.apply_file('liechtenstein-latest.osm.pbf')
    RuntimeError: Node callback keeps reference to OSM object. This is not 
allowed.
    CRITICAL: Exiting due to uncaught exception <class 'RuntimeError'>
  
  Expected Results:
  I am expecting that pywikibot would clear all references and osmium (which 
checks if objects are released) would not complain.

TASK DETAIL
  https://phabricator.wikimedia.org/T261162

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Stalker
Cc: Aklapper, pywikibot-bugs-list, Stalker, JohnsonLee01, SHEKH, Dijkstra, 
Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, 
Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to