sqlalchemy / sqlalchemy/mako

Line ending handling broken on Win32 platform

Open
#150 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug low priority
Dominant language
Python
Stars
459
Forks
90
PR merge metrics
No merged PRs in 30d

Description

Migrated issue, originally created by Anonymous

Version 0.3.4

Line ending handling of templates is broken on Windows:

For each "CR-LF" sequence in the template file you get "CR-CR-LF" in the output.

This only happens when using the filename argument to Template.init(), not if the text argument is used to supply the template.

I think this is due to opening file with mode "rb" where mode "rU" should be used to automatically convert line endings to the correct internal format on all platforms.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the filename path in Template.init and compare it with the text argument path, focusing on the mentioned rb versus rU file-opening modes. Reproduce the issue with a CR-LF template on Windows and verify that the output preserves each line ending without adding an extra carriage return.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.