py-xbrl
py-xbrl copied to clipboard
Infinite recursion loops with cyclic taxonomy imports.
When certain xbrl documents are parsed, it results in a:
RecursionError: maximum recursion depth exceeded while calling a Python object
From debugging, it looks like this is due to cyclic taxonomy imports. For example, in file Accounts_Bulk_Data-2024-02-24/Prod223_3641_06621976_20230331.html from @keyboardcrimp's issue [here] (https://github.com/manusimidt/py-xbrl/issues/127), the schema https://xbrl.frc.org.uk/fr/2022-01-01/core/frc-core-2022-01-01.xsd imports https://xbrl.frc.org.uk/dpl/2022-01-01/dpl-2022.xsd which imports https://xbrl.frc.org.uk/fr/2022-01-01/core/frc-core-2022-01-01.xsd, creating a infinite loop.
I quick fixed this by passing a set into the parse_taxonomy from parse_ixbrl and adding import_uris, checking that they have not already been imported. Not sure on your contribution policy but I can put in a PR.
Cheers, Sam
Hey @Sam-el0 , contributions via PR are always highly appreciated! :) I will also have a look into the problem
Hey @Sam-el0, thanks a lot for PR #133! I will have a look