I am a non-european studying in France on a Ph.D. and I renew my student residence permit every year. Actually I do an internship for 6 months in Switzerland that was signed as a convention between French and Swiss university and I have an L-permit. Now the Swiss propose me to stay until December to finish the current project, but that will be the stay outside the dates of signed convention between universities. Is there any danger to prolongate my swiss L-permit, if I plan to return to France and to re-apply for the student permit? May it be considered by French authorities as the interruption of résidence habituelle?
It won't be a problem, as you mentioned it's a convention between French and Swiss university, so from legal point of view it's like you still studying in France and Swiss university now it's like an internal department. So nobody can interrupt your visa. However, by my personal experience, especially for your future career, I would suggest you to remain in Switzerland.
Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted.