René's URL Explorer Experiment


Title: Variable 'dsn' needs to be initialized in create_database(). Otherwise 'UnboundLocalError: cannot access local variable' possible if 'database' arg. points to an ALIAS · Issue #56 · FirebirdSQL/python3-driver · GitHub

Open Graph Title: Variable 'dsn' needs to be initialized in create_database(). Otherwise 'UnboundLocalError: cannot access local variable' possible if 'database' arg. points to an ALIAS · Issue #56 · FirebirdSQL/python3-driver

X Title: Variable 'dsn' needs to be initialized in create_database(). Otherwise 'UnboundLocalError: cannot access local variable' possible if 'database' arg. points to an ALIAS · Issue #56 · FirebirdSQL/python3-driver

Description: Please consider func create_database(). There is following code starting from line 2400: db_config: DatabaseConfig = driver_config.get_database(database) if db_config is None: db_config = driver_config.db_defaults srv_config = driver_con...

Open Graph Description: Please consider func create_database(). There is following code starting from line 2400: db_config: DatabaseConfig = driver_config.get_database(database) if db_config is None: db_config = driver_co...

X Description: Please consider func create_database(). There is following code starting from line 2400: db_config: DatabaseConfig = driver_config.get_database(database) if db_config is None: db_config = driver_co...

Opengraph URL: https://github.com/FirebirdSQL/python3-driver/issues/56

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Variable 'dsn' needs to be initialized in create_database(). Otherwise 'UnboundLocalError: cannot access local variable' possible if 'database' arg. points to an ALIAS","articleBody":"Please consider func create_database(). \n\nThere is following code starting from line 2400:\n```\n    db_config: DatabaseConfig = driver_config.get_database(database)\n    if db_config is None:\n        db_config = driver_config.db_defaults\n        srv_config = driver_config.server_defaults\n        if _is_dsn(database):\n            dsn = database\n            database = None\n            srv_config.host.clear()\n    else:\n         . . .\n```\n\nIf control falls into the branch \"if db_config is None\" and then into \"if _is_dsn(database)\" -- all fine.\nBut if ```_is_dsn(database)``` returns False then we have a problem: ```dsn``` remains undefined until following call at line 2435:\n```\n    dsn = _connect_helper(dsn, srv_config.host.value, srv_config.port.value,\n                          database, db_config.protocol.value)\n```\nThis code will raise \"UnboundLocalError: cannot access local variable 'dsn' where it is not associated with a value\"\n\nFunction ```_is_dsn()``` may return False if value of ```database``` argument represents an ALIAS rather than file (e.g. ```db_main_alias``` used in replication tests or similar strings).\n\n\nThis is what i propose:\n```\nComparing files core.py and core-upd.py\n***** core.py\n 2401:      if db_config is None:\n 2402:          db_config = driver_config.db_defaults\n***** core-upd.py\n 2402:      # pzotov, 11.09.2025: we have to initialize here 'dsn' variable otherwise we get error\n 2403:      # UnboundLocalError: cannot access local variable 'dsn' where it is not associated with a value\n 2404:      # if the 'database' argument is an ALIAS, e.g. 'db_main_alias' etc!\n 2405:      dsn: str | None = None\n 2407:      if db_config is None:\n 2408:          db_config = driver_config.db_defaults\n*****\n```","author":{"url":"https://github.com/pavel-zotov","@type":"Person","name":"pavel-zotov"},"datePublished":"2025-09-11T16:28:14.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/56/python3-driver/issues/56"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a9a69da1-637e-e063-92c1-e2c2ff5439b3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8682:199F7E:4717ED8:62FF8F6:69714CBE
html-safe-nonce393bdc41acc472066f734b1408c8201c121816ad0a12b90d6b77eaf31f34a339
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjgyOjE5OUY3RTo0NzE3RUQ4OjYyRkY4RjY6Njk3MTRDQkUiLCJ2aXNpdG9yX2lkIjoiMjkyMDI4ODEwNjE1OTYyMzM1OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac868a4c132955c28ddfff36c705cea37373845a130a324dfe4b5cb95ee815f394
hovercard-subject-tagissue:3407277622
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/FirebirdSQL/python3-driver/56/issue_layout
twitter:imagehttps://opengraph.githubassets.com/b550e1d7d34a128a751c11bb925ffbf90a4c4928ec6576b0adb0976eb2bd5836/FirebirdSQL/python3-driver/issues/56
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/b550e1d7d34a128a751c11bb925ffbf90a4c4928ec6576b0adb0976eb2bd5836/FirebirdSQL/python3-driver/issues/56
og:image:altPlease consider func create_database(). There is following code starting from line 2400: db_config: DatabaseConfig = driver_config.get_database(database) if db_config is None: db_config = driver_co...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepavel-zotov
hostnamegithub.com
expected-hostnamegithub.com
Noneda7cbccf7f40bcd9540003423d9bef63b2fe7bb0b73fc59d91b5ae5b46000c90
turbo-cache-controlno-preview
go-importgithub.com/FirebirdSQL/python3-driver git https://github.com/FirebirdSQL/python3-driver.git
octolytics-dimension-user_id6057940
octolytics-dimension-user_loginFirebirdSQL
octolytics-dimension-repository_id260167348
octolytics-dimension-repository_nwoFirebirdSQL/python3-driver
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id260167348
octolytics-dimension-repository_network_root_nwoFirebirdSQL/python3-driver
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec9e6c71b091ca750658a3b2e3c82b0b85555f788
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues/56#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FFirebirdSQL%2Fpython3-driver%2Fissues%2F56
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FFirebirdSQL%2Fpython3-driver%2Fissues%2F56
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=FirebirdSQL%2Fpython3-driver
Reloadhttps://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues/56
Reloadhttps://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues/56
Reloadhttps://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues/56
FirebirdSQL https://patch-diff.githubusercontent.com/FirebirdSQL
python3-driverhttps://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver
Please reload this pagehttps://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues/56
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2FFirebirdSQL%2Fpython3-driver
Fork 11 https://patch-diff.githubusercontent.com/login?return_to=%2FFirebirdSQL%2Fpython3-driver
Star 36 https://patch-diff.githubusercontent.com/login?return_to=%2FFirebirdSQL%2Fpython3-driver
Code https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver
Issues 8 https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues
Pull requests 1 https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/pulls
Discussions https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/discussions
Actions https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/actions
Projects 0 https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/projects
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/security
Please reload this pagehttps://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues/56
Insights https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/pulse
Code https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver
Issues https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues
Pull requests https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/pulls
Discussions https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/discussions
Actions https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/actions
Projects https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/projects
Security https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/security
Insights https://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/FirebirdSQL/python3-driver/issues/56
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/FirebirdSQL/python3-driver/issues/56
Variable 'dsn' needs to be initialized in create_database(). Otherwise 'UnboundLocalError: cannot access local variable' possible if 'database' arg. points to an ALIAShttps://patch-diff.githubusercontent.com/FirebirdSQL/python3-driver/issues/56#top
https://github.com/pavel-zotov
https://github.com/pavel-zotov
pavel-zotovhttps://github.com/pavel-zotov
on Sep 11, 2025https://github.com/FirebirdSQL/python3-driver/issues/56#issue-3407277622
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.